Dim intNumRows As Integer
strSQL = "SELECT COUNT(*) FROM login WHERE Name = '" & Me.txtName.Text & "' AND Pass = '" & Me.txtPass.Text & "' "
objCmd = New OleDbCommand(strSQL, objConn)
Dim objConn As System.Data.OleDb.OleDbConnection
Dim objCmd As System.Data.OleDb.OleDbCommand
Dim strConnString,strSQL As String
Dim myScalar As Object
strConnString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&Server.MapPath("database/mydatabase.mdb")&";Jet OLEDB:Database Password=;"
objConn = New System.Data.OleDb.OleDbConnection(strConnString)
objConn.Open()
strSQL = "SELECT MAX(Used) FROM customer"
objCmd = New System.Data.OleDb.OleDbCommand()
With objCmd
.Connection = objConn
.CommandType = CommandType.Text
.CommandText = strSQL
End With
myScalar = objCmd.ExecuteScalar
objCmd = Nothing
objConn.Close()
objConn.Close()
objConn = Nothing
Dim objConn As New SqlConnection
Dim objCmd As New SqlCommand
Dim strConnString, strSQL As String
strConnString = "Server=saengtawan-pc\sql2008;UID=sa;PASSWORD=111111;Database=mydatabase;Max Pool Size=400;Connect Timeout=600;"
objConn.ConnectionString = strConnString
objConn.Open()
Dim intNumRows As Integer
strSQL = "SELECT COUNT(*) FROM mytable WHERE name = '" & Me.txtName.Text & "' AND pass = '" & Me.txtPass.Text & "' "
objCmd = New SqlCommand(strSQL, objConn)
intNumRows = objCmd.ExecuteScalar()