'Create a new connection
Set oConn = CreateObject("ADODB.Connection")
'Open the connection to the database
oConn.Connectionstring = "database=" + GPConnection.GPConnInterCompanyID
GPConnection.Open(oConn)
set oCMD = CreateObject("ADODB.Command")
oCMD.ActiveConnection = oConn
oCMD.CommandText = "dd_CM20400_addDistRef"
oCMD.CommandType = 4
set strCheckbook = SourceFields("MiscChecksLNE_RCL1.Checkbook")
set strTrxNum = SourceFields("MiscChecksLNE_RCL1.Check#")
set strDistRef = SourceFields("MiscChecksLNE_RCL1.Distribution Reference")
adVarChar = 200
adParamInput = 1
oCMD.Parameters.Append oCMD.CreateParameter("@CHEKBKID", adVarChar, adParamInput, 15,strCheckbook )
oCMD.Parameters.Append oCMD.CreateParameter("@cmtrxnum", adVarChar, adParamInput, 21, strTrxNum )
oCMD.Parameters.Append oCMD.CreateParameter("@distref", adVarChar, adParamInput, 31, strDistRef )
'Execute the stored procedure
oCMD.Execute
'Close the connection
Call oConn.Close