Hi,
I was earlier using recordset and query in my vb code. But since I want to
implement transactions in my code to avoid any errors, I need to use sql
stored procedure instead of sql query. Below is the code i tried to use, but
i get error message: "Mehthod or sub not found" and the CreateParanmeter ia
highlighted in the code:
Below is my code. Please help me correct it:
Dim cn As ADODB.Connection
Dim rsCheck As ADODB.Recordset
Dim cmd As ADODB.Command
Dim rsRecCount As Integer ' For counting records in a record set
Set cn = New ADODB.Connection
cn.ConnectionString = strConnectionString
cn.Open
Set cmd = New ADODB.Command
cmd.ActiveConnection = cn
cmd.CommandType = adCmdStoredProc
cmd.CommandText = "sp_ImgAlreadyUploaded"
cmd.Parameters.Append (CreateParameter("strStudy_Date", adDate,
adParamInput, , " & strStudyDate & "))
cmd.Parameters.Append (CreateParameter("strStudyTime", adDate,
adParamInput, , " & strStudyDate & "))
cmd.Parameters.Append (CreateParameter("dteBirthDate ", adDate,
adParamInput, , " & strStudyDate & "))
cmd.execute
If rsRecCount > 0 Then
intStudiesEarlierUploaded = intStudiesEarlierUploaded + 1
n = m + 1
RepeatLoop
ElseIf rsRecCount = 0 Then
CheckInDatabase()
End If

Signature
pmud
Paul Clement - 27 Jun 2006 15:06 GMT
¤ Hi,
¤
¤ I was earlier using recordset and query in my vb code. But since I want to
¤ implement transactions in my code to avoid any errors, I need to use sql
¤ stored procedure instead of sql query. Below is the code i tried to use, but
¤ i get error message: "Mehthod or sub not found" and the CreateParanmeter ia
¤ highlighted in the code:
¤
¤ Below is my code. Please help me correct it:
¤ Dim cn As ADODB.Connection
¤ Dim rsCheck As ADODB.Recordset
¤
¤ Dim cmd As ADODB.Command
¤
¤ Dim rsRecCount As Integer ' For counting records in a record set
¤
¤ Set cn = New ADODB.Connection
¤ cn.ConnectionString = strConnectionString
¤ cn.Open
¤
¤ Set cmd = New ADODB.Command
¤ cmd.ActiveConnection = cn
¤ cmd.CommandType = adCmdStoredProc
¤ cmd.CommandText = "sp_ImgAlreadyUploaded"
¤
¤ cmd.Parameters.Append (CreateParameter("strStudy_Date", adDate,
¤ adParamInput, , " & strStudyDate & "))
¤ cmd.Parameters.Append (CreateParameter("strStudyTime", adDate,
¤ adParamInput, , " & strStudyDate & "))
¤ cmd.Parameters.Append (CreateParameter("dteBirthDate ", adDate,
¤ adParamInput, , " & strStudyDate & "))
¤
¤ cmd.execute
¤
¤ If rsRecCount > 0 Then
¤
¤ intStudiesEarlierUploaded = intStudiesEarlierUploaded + 1
¤ n = m + 1
¤ RepeatLoop
¤ ElseIf rsRecCount = 0 Then
¤ CheckInDatabase()
¤ End If
CreateParameter is a method of the Command object. If you don't specify the Command object Visual
Basic won't know what it is.
Paul
~~~~
Microsoft MVP (Visual Basic)
pmud - 27 Jun 2006 15:20 GMT
Thanks Paul.

Signature
pmud
> ¤ Hi,
> ¤
[quoted text clipped - 45 lines]
> ~~~~
> Microsoft MVP (Visual Basic)