Subject: MySQL V.Net Connection property has not been initi
Posted By: Wilco Post Date: 8/21/2006 3:02:11 AM
G'day
Can anyone help me as to why this does not work?
Thanks if you can
Dim Conn As OdbcConnection
        Dim sConn As String
        Dim Cmd As OdbcCommand
        Dim Rd As OdbcDataReader
        Dim strSQL As String
        strSQL = "select namemain from en_tblentities"
        Conn = New OdbcConnection
        sConn = "DRIVER={MySQL ODBC 3.51

Driver};SERVER=localhost;DATABASE=test;USER=root;PASSWORD=thewiggles;option=3"
        Conn.ConnectionString = sConn
        Conn.Open()
        Cmd = New OdbcCommand
        Cmd.CommandText = strSQL

        Rd = Cmd.ExecuteReader
        While Rd.Read
            s = s & "<BR>" & Rd("namemain")
        End While
        Response.Write(s)
    ........

ExecuteReader: Connection property has not been initialized.
Description: An unhandled exception occurred during the execution of the current

web request. Please review the stack trace for more information about the error and

where it originated in the code.

Exception Details: System.InvalidOperationException: ExecuteReader: Connection

property has not been initialized.

Source Error:


Line 46:         Cmd.CommandText = strSQL
Line 47:
Line 48:         Rd = Cmd.ExecuteReader
Line 49:         While Rd.Read
Line 50:             s = s & "<BR>" & Rd("NameMain")
 

Source File: D:\TestProj\IN_Investments\frmTestMySQL.aspx.vb    Line: 48


Go to topic 48613

Return to index page 198
Return to index page 197
Return to index page 196
Return to index page 195
Return to index page 194
Return to index page 193
Return to index page 192
Return to index page 191
Return to index page 190
Return to index page 189