⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 module2.bas

📁 以上所有操作应用程序及数据库均要对其进行合法性有效性验证及相关约束条件检查
💻 BAS
字号:
Attribute VB_Name = "CommandInsert"
Public Sub EXECommand()

With adoCommand
    .Parameters.Refresh
    .Parameters.Append .CreateParameter("RETURN_VALUE", adInteger, adParamReturnValue, , Null)
    .Parameters.Append .CreateParameter("@isbn", adChar, adParamInput, 20, strIsbn)
    .Parameters.Append .CreateParameter("@date", adDBTimeStamp, adParamInput, , "2000-11-30 12:30")
    .Parameters.Append .CreateParameter("@title", adChar, adParamInput, 100, strTitle)
    .Parameters.Append .CreateParameter("@author", adChar, adParamInput, 50, strAuthor)
    .Parameters.Append .CreateParameter("@publish", adChar, adParamInput, 100, strPublish)
    .Parameters.Append .CreateParameter("@price", adInteger, adParamInput, , intPrice)
    .Parameters.Append .CreateParameter("@source", adChar, adParamInput, 100, strSource)
      .Parameters.Append .CreateParameter("@ProductID", adInteger, adParamInputOutput, , Null)
End With
End Sub

Public Function EXECInsert(ByVal strIsbn As String, ByVal dateTimeNow As Date, ByVal strTitle As String, ByVal strAuthor As String, _
                            ByVal strPublish As String, ByVal intPrice As Integer, ByVal strSource)
                            
With adoCommand
    .ActiveConnection = Aconnection
    .Parameters("@isbn") = strIsbn
    .Parameters("@date") = dateTimeNow
    .Parameters("@title") = strTitle
    .Parameters("@author") = strAuthor
    .Parameters("@publish") = strPublish
    .Parameters("@price") = intPrice
    .Parameters("@source") = strSource
    .Parameters("@ProductID") = Null
    
    
    .CommandText = "AddProduct"
    .CommandType = adCmdStoredProc
    
    .Execute
    
    .ActiveConnection = Nothing
    
     If .Parameters("RETURN_VALUE") = 0 Then
        MISBN = .Parameters("@ProductID")
    Else
        MsgBox "unable to add new isbn", vbCritical
        MISBN = 0
    End If
    End With
End Function

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -