📄 classproduct.vb
字号:
Imports System.Text
Imports System.Data
Public Class ClassProduct
Public Function Add(ByVal strProductId As String, ByVal strProductName As String, ByVal strUnit As String, ByVal strStorage As String, ByVal strSelling As String, ByVal strCost As String, ByVal strTotal As String) As Boolean
Dim strSQL As StringBuilder = New StringBuilder()
strSQL.AppendLine("INSERT INTO")
strSQL.AppendLine("Product")
strSQL.AppendLine("VALUES")
strSQL.AppendLine("(")
strSQL.AppendLine(strProductId & ",")
strSQL.AppendLine("'" & strProductName & "',")
strSQL.AppendLine("'" & strUnit & "',")
strSQL.AppendLine(strStorage & ",")
strSQL.AppendLine(strSelling & ",")
strSQL.AppendLine(strCost & ",")
strSQL.AppendLine(strTotal & "")
strSQL.AppendLine(")")
Return ClassCommon.RunSql(strSQL.ToString)
End Function
Public Function Delete(ByVal strProductid As String) As Boolean
Dim strSQL As StringBuilder = New StringBuilder()
strSQL.AppendLine("DELETE FROM")
strSQL.AppendLine("Product")
strSQL.AppendLine("WHERE")
strSQL.AppendLine("ProductId=" & strProductid)
Return ClassCommon.RunSql(strSQL.ToString)
End Function
Public Function Edit(ByVal strProductId As String, ByVal strProductName As String, ByVal strUnit As String, ByVal strStorage As String, ByVal strSelling As String, ByVal strCost As String, ByVal strTotal As String) As Boolean
Dim strSQL As StringBuilder = New StringBuilder()
strSQL.AppendLine("UPDATE")
strSQL.AppendLine("Product")
strSQL.AppendLine("SET")
strSQL.AppendLine("ProductName")
strSQL.AppendLine("=")
strSQL.AppendLine("'" & strProductName & "',")
strSQL.AppendLine("Unit")
strSQL.AppendLine("=")
strSQL.AppendLine("'" & strUnit & "',")
strSQL.AppendLine("Storage")
strSQL.AppendLine("=")
strSQL.AppendLine("" & strStorage & ",")
strSQL.AppendLine("SellingRate")
strSQL.AppendLine("=")
strSQL.AppendLine("" & strSelling & ",")
strSQL.AppendLine("Cost")
strSQL.AppendLine("=")
strSQL.AppendLine("" & strCost & ",")
strSQL.AppendLine("TotalNumber")
strSQL.AppendLine("=")
strSQL.AppendLine("" & strTotal & "")
strSQL.AppendLine("WHERE")
strSQL.AppendLine("ProductId")
strSQL.AppendLine("=")
strSQL.AppendLine("" & strProductId & "")
Return ClassCommon.RunSql(strSQL.ToString)
End Function
Public Function GetRowById(ByRef ds As Data.DataSet, ByVal id As String) As Boolean
Dim strSql As New StringBuilder
strSql.AppendLine("SELECT")
strSql.AppendLine("*")
strSql.AppendLine("FROM")
strSql.AppendLine("Product")
strSql.AppendLine("WHERE")
strSql.AppendLine("ProductId = " & id)
Return ClassCommon.RunSql(ds, strSql.ToString)
End Function
Public Function List(ByRef ds As Data.DataSet) As Boolean
Dim strSql As New StringBuilder
strSql.AppendLine("SELECT")
strSql.AppendLine("*")
strSql.AppendLine("FROM")
strSql.AppendLine("Product")
Return ClassCommon.RunSql(ds, strSql.ToString)
End Function
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -