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;P ASSWORD=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