hi, I have a vb program that wants to retrieve data from MySQL dbase.
this code is working fine :
Dim vDATE As String
vDATE = mDATE.ToString("yyyy/MM/dd", System.Globalization.CultureInfo.InvariantCulture)
Dim connstring As String = "server=xxx.xxx.x.xx;database=dbname;uid=idko;Pwd=passko"
Using con As New MySqlConnection(connstring)
con.Open()
Dim query As String = "SELECT issue_date, inc_date, exp_date, total FROM table_name WHERE COC_DATE = @DATE "
Dim MYSQLCMD As New MySqlCommand(query, con)
MYSQLCMD.Parameters.AddWithValue("@DATE", vDATE)
Dim reader As MySqlDataReader = MYSQLCMD.ExecuteReader
While reader.Read
MessageBox.Show(reader.GetString(0) & vbCr & reader.GetString(1) & vbCr & reader.GetString(2) & vbCr & reader.GetString(3))
End While
End Using
but the code below give me an error that says "A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond"
Dim vDATE As String
vDATE = mDATE.ToString("yyyy/MM/dd", System.Globalization.CultureInfo.InvariantCulture)
Dim connstring As String = "server=xxx.xxx.x.xx;database=dbname;uid=idko;Pwd=passko"
Using con As New MySqlConnection(connstring)
con.Open()
Dim query As String = "SELECT ref_no,name, address,zipcode FROM table_name WHERE COC_DATE = @DATE "
Dim MYSQLCMD As New MySqlCommand(query, con)
MYSQLCMD.Parameters.AddWithValue("@DATE", vDATE)
Dim reader As MySqlDataReader = MYSQLCMD.ExecuteReader
While reader.Read
MessageBox.Show(reader.GetString(0) & vbCr & reader.GetString(1) & vbCr & reader.GetString(2) & vbCr & reader.GetString(3))
End While
End Using
any help would be greatly appreciated.
thank you.
this code is working fine :
Dim vDATE As String
vDATE = mDATE.ToString("yyyy/MM/dd", System.Globalization.CultureInfo.InvariantCulture)
Dim connstring As String = "server=xxx.xxx.x.xx;database=dbname;uid=idko;Pwd=passko"
Using con As New MySqlConnection(connstring)
con.Open()
Dim query As String = "SELECT issue_date, inc_date, exp_date, total FROM table_name WHERE COC_DATE = @DATE "
Dim MYSQLCMD As New MySqlCommand(query, con)
MYSQLCMD.Parameters.AddWithValue("@DATE", vDATE)
Dim reader As MySqlDataReader = MYSQLCMD.ExecuteReader
While reader.Read
MessageBox.Show(reader.GetString(0) & vbCr & reader.GetString(1) & vbCr & reader.GetString(2) & vbCr & reader.GetString(3))
End While
End Using
but the code below give me an error that says "A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond"
Dim vDATE As String
vDATE = mDATE.ToString("yyyy/MM/dd", System.Globalization.CultureInfo.InvariantCulture)
Dim connstring As String = "server=xxx.xxx.x.xx;database=dbname;uid=idko;Pwd=passko"
Using con As New MySqlConnection(connstring)
con.Open()
Dim query As String = "SELECT ref_no,name, address,zipcode FROM table_name WHERE COC_DATE = @DATE "
Dim MYSQLCMD As New MySqlCommand(query, con)
MYSQLCMD.Parameters.AddWithValue("@DATE", vDATE)
Dim reader As MySqlDataReader = MYSQLCMD.ExecuteReader
While reader.Read
MessageBox.Show(reader.GetString(0) & vbCr & reader.GetString(1) & vbCr & reader.GetString(2) & vbCr & reader.GetString(3))
End While
End Using
any help would be greatly appreciated.
thank you.