classclient.vb
来自「这是一个订单管理系统」· VB 代码 · 共 80 行
VB
80 行
Imports System
Imports System.Text
Imports System.Data
Public Class ClassClient
Public Function Add(ByVal strId As String, ByVal strName As String, ByVal strType As String, ByVal strMoney As String) As Boolean
Dim strSQL As StringBuilder = New StringBuilder()
strSQL.AppendLine("INSERT INTO ")
strSQL.AppendLine("Client")
strSQL.AppendLine("(")
strSQL.AppendLine("ClientId,")
strSQL.AppendLine("ClientName,")
strSQL.AppendLine("TypeId,")
strSQL.AppendLine("Money")
strSQL.AppendLine(")")
strSQL.AppendLine("VALUES")
strSQL.AppendLine("(")
strSQL.AppendLine(strId & ",")
strSQL.AppendLine("'" & strName & "',")
strSQL.AppendLine(strType & ",")
strSQL.AppendLine(strMoney)
strSQL.AppendLine(")")
Return ClassCommon.RunSql(strSQL.ToString)
End Function
Public Function Delete(ByVal Intid As Integer) As Boolean
Dim strSQL As StringBuilder = New StringBuilder()
strSQL.AppendLine("DELETE FROM")
strSQL.AppendLine("Client")
strSQL.AppendLine("WHERE")
strSQL.AppendLine("ClientId")
strSQL.AppendLine("=")
strSQL.AppendLine("" & Intid.ToString & "")
Return ClassCommon.RunSql(strSQL.ToString)
End Function
Public Function Edit(ByVal strId As String, ByVal Strname As String, ByVal strTypeid As String, Optional ByVal strMoney As String = "") As Boolean
Dim strSQL As StringBuilder = New StringBuilder()
strSQL.AppendLine("UPDATE ")
strSQL.AppendLine("Client")
strSQL.AppendLine("SET")
strSQL.AppendLine("ClientName")
strSQL.AppendLine("=")
strSQL.AppendLine(" '" & Strname & "',")
strSQL.AppendLine("TypeId = " & strTypeid)
If strMoney <> "" Then
strSQL.AppendLine(",Money = " & strMoney & "")
End If
strSQL.AppendLine("WHERE")
strSQL.AppendLine("ClientId =" & strId)
Return ClassCommon.RunSql(strSQL.ToString)
End Function
Public Function GetRowById(ByRef dsClient As DataSet, ByVal strId As String) As Boolean
Dim strSql As New StringBuilder
strSql.AppendLine("SELECT")
strSql.AppendLine("*")
strSql.AppendLine("FROM")
strSql.AppendLine("Client")
strSql.AppendLine("WHERE")
strSql.AppendLine("ClientId =" & strId)
Return ClassCommon.RunSql(dsClient, strSql.ToString)
End Function
Public Function List(ByRef dsClient As DataSet) As Boolean
Dim strSql As New StringBuilder
strSql.AppendLine("SELECT")
strSql.AppendLine("*")
strSql.AppendLine("FROM")
strSql.AppendLine("Client")
Return ClassCommon.RunSql(dsClient, strSql.ToString)
End Function
End Class
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?