please someone help me convert this from access database to sql server 2005
thank you
CODE
Option Strict Off
Option Explicit On
Imports VB = Microsoft.VisualBasic
Friend Class frmLogin
Inherits System.Windows.Forms.Form
Private Sub Command2_Click()
End Sub
Private Sub cmdCancel_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdCancel.Click
Me.Close()
End Sub
Private Sub cmdOk_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdOk.Click
Dim db_file As String
Dim statement As String
Dim conn As ADODB.Connection
Dim rs As ADODB.Recordset
' Open the database.
db_file = My.Application.Info.DirectoryPath
If VB.Right(db_file, 1) <> "\" Then db_file = db_file & "\"
db_file = db_file & "data.mdb"
' Open a connection.
conn = New ADODB.Connection
conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" & db_file & ";" & "Persist Security Info=False"
conn.Open()
' Look up the user name/password.
statement = "SELECT COUNT (*) FROM Users WHERE " & "UserName='" & Replace(txtUserName.Text, "'", "''") & "' AND " & "Password='" & Replace(txtPassword.Text, "'", "''") & "'"
rs = conn.Execute(statement)
' See if we got anything.
If CInt(rs.Fields(0).Value) < 1 Then
' There is no match.
' Do not allow the login.
Me.Close()
MsgBox("Invalid user name/password.")
Else
' There is a match.
' Display the program's main form.
Form1.Show()
Me.Close()
End If
rs.Close()
conn.Close()
End Sub
End Class