Yeah... have been trying to use ADO.NEt with MySQL and i havent really been very successful!
Heres what i do...
' Dimension them all....
Dim OleDbCmd As New OleDb.OleDbCommand()
Dim OleDbCnn As New OleDb.OleDbConnection()
Dim _SqlText, _ConnectionString As String
Dim objDatadrd As IDataReader
Dim _ReturnStatus As Integer
' The connection string...
_ConnectionString = "Provider=MySqlProv;Data Source=The source;Integrated Security=;Password=Thepassword;User ID=TheUID;Location=SERVER;Extended Properties="
OleDbCmd.Connection = OleDbCnn
OleDbCmd.Connection.ConnectionString = _ConnectionString
' The SQL STring...
_SqlText = "select * from agency where agency_id = ?"
' This string executes just fine because there arent any parameters...
' _SqlText = "select * from agency where agency_id = 1"
OleDbCmd.Parameters.Add("@AgencyId", 1)
OleDbCmd.CommandText = _SqlText
OleDbCmd.CommandType = CommandType.Text
' The connection opens just fine...
OleDbCmd.Connection.Open()
' This is what fails... command object with parameters fails...
objDatadrd = OleDbCmd.ExecuteReader(CommandBehavior.CloseConnection)
If objDatadrd.Read Then
MsgBox(objDatadrd("agency_code")
End If
Thanks for the help...
Sham Sham aka boolean... be practical/be straight... true/false?!
Heres what i do...
' Dimension them all....
Dim OleDbCmd As New OleDb.OleDbCommand()
Dim OleDbCnn As New OleDb.OleDbConnection()
Dim _SqlText, _ConnectionString As String
Dim objDatadrd As IDataReader
Dim _ReturnStatus As Integer
' The connection string...
_ConnectionString = "Provider=MySqlProv;Data Source=The source;Integrated Security=;Password=Thepassword;User ID=TheUID;Location=SERVER;Extended Properties="
OleDbCmd.Connection = OleDbCnn
OleDbCmd.Connection.ConnectionString = _ConnectionString
' The SQL STring...
_SqlText = "select * from agency where agency_id = ?"
' This string executes just fine because there arent any parameters...
' _SqlText = "select * from agency where agency_id = 1"
OleDbCmd.Parameters.Add("@AgencyId", 1)
OleDbCmd.CommandText = _SqlText
OleDbCmd.CommandType = CommandType.Text
' The connection opens just fine...
OleDbCmd.Connection.Open()
' This is what fails... command object with parameters fails...
objDatadrd = OleDbCmd.ExecuteReader(CommandBehavior.CloseConnection)
If objDatadrd.Read Then
MsgBox(objDatadrd("agency_code")
End If
Thanks for the help...
Sham Sham aka boolean... be practical/be straight... true/false?!