hi everyone,
need to get some advice, when opening mysql connection what is the way
using
Imports MySql.Data.MySqlClient (use in my current vb.ney proj)
or
ado connection? (use in my current vb6)
thx in advance.
hi everyone,
need to get some advice, when opening mysql connection what is the way
using
Imports MySql.Data.MySqlClient (use in my current vb.ney proj)
or
ado connection? (use in my current vb6)
thx in advance.
Following is sample code.
Imports System.Data.SqlClient ' This needs to be in header section.
//------ Following should be in your function body.
Dim con As New SqlConnection("Connection String")
Dim query As String = "SQL query" <---- Your SQL Query
Dim cmd As New SqlCommand(query, con) <---- Passing query via Connection object 'con'
con.open()
If cmd.ExecuteNonQuery() = 0 Then
MessageBox.Show("Query Executed.")
Else
MessageBox.Show("Query failed to execute.")
End If
con.close()
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.