📄 customer.vb
字号:
Imports System.Data.SqlClient
Public Interface ICustomer
Function LogOn(ByVal Email As String, ByVal Password As String) As DataSet
End Interface
Public Class Customer
Implements ICustomer
Private connString As String
Public Function LogOn(ByVal Email As String, ByVal Password As String) As DataSet Implements ICustomer.Logon
Try
Dim conn As New SqlConnection(connString)
Dim adaptSQL As New SqlDataAdapter("Select CustomerID, FirstName, LastName, CompanyName, Address from Customers where Email = '" & Email & "' and Pword = '" & Password & "'", conn)
Dim datCustomer As New DataSet()
'open the connection and get the data
conn.Open()
adaptSQL.Fill(datCustomer)
'check if machine data was found, and update Last_LogOn datetime value
If datCustomer.Tables(0).Rows.Count > 0 Then
Dim cmd As New SqlCommand("Update Customers Set Last_Logon = GetDate() Where CustomerID = " & datCustomer.Tables(0).Rows(0)("CustomerID"), conn)
cmd.ExecuteNonQuery()
End If
conn.Close()
Return datCustomer
Catch ex As Exception
Throw (ex)
End Try
End Function
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -