?? 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 + -