Who Can Help me For DataBase?
Hello
I Have a problem to programming of the vb.net. :confused:
I want to have a help for database in vb.net. :confused:
(SQL Functions or ...) :cool:
# 1 Re: Who Can Help me For DataBase?
Hey,
Here's a basic function I wrote for sending a query in Sql using VB.NET. You can pass any sql query to the function when calling it.
Imports System.Data.SqlClient
'///////////////////////////////////////////////////////////////////////////////
'// //
'// Doquery: This routine handles all of our MySQL queries. //
'// //
'// Parameters: Customquery - A query string to send the function //
'// //
'///////////////////////////////////////////////////////////////////////////////
Public Sub Doquery(ByVal customQuery As String)
'Database Connection Parameters
Dim myDataReader As SqlDataReader
Dim mySqlConnection As SqlConnection
Dim mySqlCommand As SqlCommand
mySqlConnection = New SqlConnection("Data Source=" & ";User ID=" & ";Password=" & ";Initial Catalog=")
mySqlCommand = New SqlCommand(customQuery, mySqlConnection)
mySqlConnection.Open()
'Execute our query
myDataReader = mySqlCommand.ExecuteReader(CommandBehavior.CloseConnection)
mySqlConnection.Close()
End Sub