I cannot make a mysql query with a question mark as the value of the string or the program freezes and says "Parameter '*string with the question mark in it*' must be defined" and it highlights "cmd.ExecuteNonQuery()". This the block of code:
Dim cmd As New MySqlClient.MySqlCommand
Dim connect As New MySqlClient.MySqlConnection("Database=*database name*;Data Source=tehplanet.net;User Id=*my username*;Password=*my passwod*")
Question
~Matt~
I cannot make a mysql query with a question mark as the value of the string or the program freezes and says "Parameter '*string with the question mark in it*' must be defined" and it highlights "cmd.ExecuteNonQuery()". This the block of code:
Dim connect As New MySqlClient.MySqlConnection("Database=*database name*;Data Source=tehplanet.net;User Id=*my username*;Password=*my passwod*")
Dim the_time As String = System.DateTime.Now
Dim WC As New System.Net.WebClient
Dim the_ip As String
the_ip = System.Text.Encoding.ASCII.GetString((WC.DownloadData("http://whatismyip.com/automation/n09230945.asp")))
WC.Dispose()
If string_to_process.Text <> Nothing Then
cmd.CommandText = "INSERT INTO `table name`(string, ip, time) VALUES (?" & string_to_process.Text & "?, ?" & the_ip & "?, ?" & the_time & "?)"
cmd.Connection = connect
connect.Open()
cmd.ExecuteNonQuery()
connect.Close()
E[i][/i]code]
Link to comment
Share on other sites
6 answers to this question
Recommended Posts