
Error -2147217887 [Microsoft][ODBC SQL Server Driver]Optional feature not implemented ,
Hi!
When try to execute a stored procedure from a vb applacation
with adodb command get this Error:
-2147217887
[Microsoft][ODBC SQL Server Driver]Optional feature not implemented
when exectue the same sp from query analy.. it works!
Thanks!
My stored procdure code:
int AS
raiserror('wrong nummber product: ',16,1)
return (22)
begin
return (1)
end
begin
return (2)
end
insert purchase
begin
raiserror('insert purchase :error => %d, customerid => %d,productid =>
return (3)
end
begin
raiserror('insert purchase :rowcount=> %d, customerid => %d,productid =>
return (4)
end
My code in vb.dll that is created in a asp file:
Sub readform()
Dim paramReturn As New ADODB.Parameter
Dim paramItemid As New ADODB.Parameter
Dim paramItemantal As New ADODB.Parameter
Dim paramCustid As New ADODB.Parameter
Set objContShop = GetObjectContext()
Set respShop = objContShop("Response")
Set reqShop = objContShop("Request")
On Error GoTo getform
respShop.Write "<html><head></head><body><h1>please wait....!</h1>"
ee = 0
strFnamn = Trim(reqShop.Form("fnamn"))
If Len(strFnamn) < 1 Then
Err.Raise vbObjectError + 120, "procdessform", "Du m?ste fylla ditt
f?rnamn"
End If
strEnamn = Trim(reqShop.Form("enamn"))
If Len(strEnamn) < 1 Then
Err.Raise vbObjectError + 130, "procdessform", "Du m?ste fylla ditt
efternamn"
End If
ee = 1
strAddress1 = Trim(reqShop.Form("address1"))
strAddress2 = Trim(reqShop.Form("address2"))
If (Len(strAddress1) < 1 And Len(strAddress2) < 1) Then
Err.Raise vbObjectError + 140, "procdessform", "Du m?ste fylla ditt
address"
ElseIf Len(strAddress1) < 1 Then
strAddress1 = "Unknown"
ElseIf Len(strAddress2) < 1 Then
strAddress2 = "Unknown"
End If
ee = 2
strPostkod = CInt(Trim(reqShop.Form("postkod")))
If Len(strPostkod) < 1 Then
Err.Raise vbObjectError + 150, "procdessform", "Du m?ste fylla ditt
postkod"
End If
ee = 3
strStad = Trim(reqShop.Form("stad"))
If Len(strStad) < 1 Then
Err.Raise vbObjectError + 160, "procdessform", "Du m?ste fylla ditt
postort"
End If
ee = 4
strEmail = Trim(reqShop.Form("email"))
If Len(strEmail) < 1 Then
Err.Raise vbObjectError + 170, "procdessform", "Du m?ste fylla ditt
email-address"
End If
ee = 5
strTel = Trim(reqShop.Form("tel"))
If Len(strTel) < 1 Then
strTel = "Unknown"
End If
Set cnShop = New Connection
Set rsShop = New Recordset
cnShop.ConnectionString = strConnect
cnShop.Open
Set cmdShop = New Command
cmdShop.ActiveConnection = cnShop
cmdShop.CommandType = adCmdStoredProc
cmdShop.CommandText = "insertPurchase"
paramReturn.Direction = adParamReturnValue
paramReturn.Type = adInteger
paramReturn.Size = 4
cmdShop.Parameters.Append paramReturn
paramItemid.Direction = adParamInput
paramItemid.Type = adBigInt
paramItemid.Size = 4
cmdShop.Parameters.Append paramItemid
paramItemantal.Direction = adParamInput
paramItemantal.Type = adInteger
paramItemantal.Size = 4
cmdShop.Parameters.Append paramItemantal
paramCustid.Direction = adParamInput
paramCustid.Type = adInteger
paramCustid.Size = 4
cmdShop.Parameters.Append paramCustid
summa = 0
cnShop.BeginTrans
ee = 6
Set rsShop = cnShop.Execute("execute insertkund " & strFnamn & " , " &
strEnamn & " , " & strAddress1 & " , " & strAddress2 & " , " & strPostkod &
" , " & strStad & " , " & strTel & " , " & strEmail)
ee = 7
If (rsShop!custerror <> 0) Then
Err.Raise rsShop!custerror, "prossesform", "Error from insertkund stored
procedure"
End If
ee = 8
If (rsShop!custcount <> 1) Then
Err.Raise vbObjectError + 100, "prossesform", "Can't get right
customerid"
End If
ee = 9
paramCustid.Value = rsShop!custidentity
ee = 10
paramReturn.Value = 10
ee = 11
itemcount = reqShop.Form("list").Count
ee = 12
For j = 1 To itemcount
ee = 13
strItemid = reqShop.Form("list")(j)
ee = 14
'respShop.Write Trim(strItemid)
ee = 15
itemid = CLng(Trim(strItemid))
ee = 16
paramItemid.Value = itemid
j = j + 1
strItemantal = reqShop.Form("list")(j)
itemantal = CLng(Trim(strItemantal))
paramItemantal.Value = itemantal
ee = 17
j = j + 1
Set rsShop = cmdShop.Execute /*Here is the problem*/
ee = 18
If (paramReturn.Value <> 0) Then
Err.Raise vbObjectError + 170, "prossesform", "return code from
insertPurchase is " & paramReturn.Value
End If
summa = summa + rsShop!totalprice
ee = 19
Next
cnShop.CommitTrans
cnShop.Close
respShop.Write "" & summa & "</body></html>"
Exit Sub
getform:
respShop.Write ("ddddddd " & CStr(paramReturn.Value) & "<br>")
respShop.Write Err.Number & "<br>"
respShop.Write Err.Description & " ===ffffffff " & ee & "</body></html>"
cnShop.RollbackTrans
cnShop.Close
End Sub