cuemasterfl
Supreme [H]ardness
- Joined
- Jul 5, 2001
- Messages
- 4,181
Any idea what's wrong with this? I have verified that the settings are correct with the database host. VS2010 gives me this error:
Cannot connect to database: Unable to connect to any of the specified mySQL hosts.
Thanks.
Cannot connect to database: Unable to connect to any of the specified mySQL hosts.
Thanks.
Code:
SQL = "INSERT INTO `snaps` (`id` ,`username` ,`pictureid` ,`views` ,`date` ,`lastlook`) VALUES ('', '" & username & "', '" & imagefilename & imageextension & "', '0', '" & lastlook & "', " & "'" & lastlook & "'" & ")"
MysqlConn = New MySqlConnection()
MysqlConn.ConnectionString = "server=xxx.xxx.xxx.xxx;" & "user id=xxxxxx;" & "password=xxxxxx;" & "database=ezsnap_ezsnap"
Try
MysqlConn.Open()
SQLCommand.Connection = MysqlConn
SQLCommand.CommandText = SQL
SQLAdapter.SelectCommand = SQLCommand
Dim result As String = SQLCommand.ExecuteNonQuery
Catch myerror As MySqlException
MessageBox.Show("Cannot connect to database: " & myerror.Message)
Finally
MysqlConn.Close()
MysqlConn.Dispose()
End Try