Retrieving the files from MySql

Last post 08-08-2007 6:04 AM by CLIPER. 1 replies.

Sort Posts:

  • Retrieving the files from MySql

    08-08-2007, 12:59 AM
    • Loading...
    • rkrathi04
    • Joined on 08-08-2007, 4:55 AM
    • Posts 37

     I wrote the code for storing the files in the MySql database. Can any one tell me how can I retrieve them back? Here is my code:

     

     Dim MyConString As String = "DRIVER={MySQL ODBC 3.51 Driver}; SERVER=localhost; DATABASE= student; UID=root; PASSWORD=123456;"
            Dim MyConnection As New System.Data.Odbc.OdbcConnection(MyConString)
            MyConnection.Open()
            Dim adap As New System.Data.Odbc.OdbcDataAdapter
            Dim insertstr As String = " insert into detail values ('" + Nametxt.Text + "'," + Phonetxt.Text + ",'" + Emaitxt.Text + "'," + "')"
            Dim comm As New System.Data.Odbc.OdbcCommand(insertstr, MyConnection)
            comm.ExecuteNonQuery()
            Label3.Text = " Record stored sucessfully"

     

    Many Thanks,

    Ramesh 


     

  • Re: Retrieving the files from MySql

    08-08-2007, 6:04 AM
    • Loading...
    • CLIPER
    • Joined on 07-18-2004, 9:54 AM
    • Philippines
    • Posts 367

    Hi, hope this will help.. I'll just use your current terms used in this thread.

     

    1    Dim objReader As MySqlDataReader
    2    Dim comm As MySqlCommand
    3    
    4    comm = new MySqlCommand("SELECT * FROM detail", MyConnection)
    5    objReader = comm.ExecuteReader()
    6    
    7    Do while objReader.Read
    8      Response.write(objReader("field_name_here"))
    9    Loop
    10   
    11   myconnection.close()
    12   myconnection.dispose()
    13   objreader.close
    14   
    15   
    

     

    happy coding!

     

    Cheers,

    CLIPER
     

    ------------------------------------------------
    Believe nothing, no matter where you read it, or who said it, no matter if I have said it, unless it agrees with your own reason and your own commonsense. ---Buddha (563BC-483BC)
Page 1 of 1 (2 items)
Microsoft Communities
Page view counter