J
Jack
Hi,
I got a access form from where I sending parameter to a sql server stored
procedure. I need to display the values that are being passed to the stored
procedure. How do I go about doing that in the most easiest way. Thanks
CODE:
rivate Sub cmdRunProc1_Click()
Dim conn As ADODB.Connection
'Dim cmdUpdate As ADODB.Command
Dim lngRecs
Dim strType
Dim curPercent
Set conn = New ADODB.Connection
conn.Provider = "SQLOLEDB"
conn.ConnectionString = "Provider=SQLOLEDB.1;Initial Catalog=pubs;Data
Source=USILDEK1-21001;User ID=sa;Password=alloyd;"
conn.Open
Set cmdUpdate = New ADODB.Command
cmdUpdate.CommandType = adCmdStoredProc
cmdUpdate.CommandText = "usp_UpdatePrices"
Set cmdUpdate.ActiveConnection = conn
' Get the form values
strType = Forms!frmParamPassing_mod!txtBookType
curPercent = Forms!frmParamPassing_mod!txtPercent
curPercent1 = CCur(Forms!frmParamPassing_mod!txtPercent)
Debug.Print strType
Debug.Print curPercent1
' Add the parameters
cmdUpdate.Parameters.Append cmdUpdate.CreateParameter("@Type",
adVarWChar, adParamInput, 12, strType)
cmdUpdate.Parameters.Append cmdUpdate.CreateParameter("@Percent",
adCurrency, adParamInput, , curPercent1)
' Execute the command
cmdUpdate.Execute lngRecs, , adExecuteNoRecords
' And finally tell the user what's happened
MsgBox ("Procedure complete. Records were updated")
Set conn = Nothing
Set cmdUpdate = Nothing
End Sub
I got a access form from where I sending parameter to a sql server stored
procedure. I need to display the values that are being passed to the stored
procedure. How do I go about doing that in the most easiest way. Thanks
CODE:
rivate Sub cmdRunProc1_Click()
Dim conn As ADODB.Connection
'Dim cmdUpdate As ADODB.Command
Dim lngRecs
Dim strType
Dim curPercent
Set conn = New ADODB.Connection
conn.Provider = "SQLOLEDB"
conn.ConnectionString = "Provider=SQLOLEDB.1;Initial Catalog=pubs;Data
Source=USILDEK1-21001;User ID=sa;Password=alloyd;"
conn.Open
Set cmdUpdate = New ADODB.Command
cmdUpdate.CommandType = adCmdStoredProc
cmdUpdate.CommandText = "usp_UpdatePrices"
Set cmdUpdate.ActiveConnection = conn
' Get the form values
strType = Forms!frmParamPassing_mod!txtBookType
curPercent = Forms!frmParamPassing_mod!txtPercent
curPercent1 = CCur(Forms!frmParamPassing_mod!txtPercent)
Debug.Print strType
Debug.Print curPercent1
' Add the parameters
cmdUpdate.Parameters.Append cmdUpdate.CreateParameter("@Type",
adVarWChar, adParamInput, 12, strType)
cmdUpdate.Parameters.Append cmdUpdate.CreateParameter("@Percent",
adCurrency, adParamInput, , curPercent1)
' Execute the command
cmdUpdate.Execute lngRecs, , adExecuteNoRecords
' And finally tell the user what's happened
MsgBox ("Procedure complete. Records were updated")
Set conn = Nothing
Set cmdUpdate = Nothing
End Sub