25 | 03 | 2017

MySQL Run Query

To delete an item from the MySQL database use the code below.

This article codes needs the code from the article below to function.

http://www.visiblevisual.com/jupgrade/index.php/general-net/197-connect-to-mysql-using-vbnet

 

Function RunQuery(ByVal MySQLQuery As String) As Boolean

If ConnectToDB() = False Then Exit Function 'see the article on how to Connect to mysql

Dim objCmd As MySqlCommand

Try

objCmd = New MySqlCommand(MySQLQuery , ConnSQL )
dtReader = objCmd.ExecuteReader
ConnSQL.Close()

Catch ex As MySqlException
RunQuery = False
'MessageBox.Show("Error running query at the MySQL database: " + ex.Message)
Exit Function
End Try

RunQuery = True


Exit Function

Errorhandler:

RunQuery = False

End Function
Login

Sign up now and upload your code to the website.

Help us to continue.....
Statistics
Articles View Hits
2208271
Latest Articles