Article ID: 178445
Article Last Modified on 11/7/2003
Dim cn As New rdoConnection
Private Sub Command1_Click()
Dim qy As New rdoQuery
With qy
Set .ActiveConnection = cn
.SQL = "{? = CALL InputBLOBTest(?, ?, ?) }"
End With
qy(0).Direction = rdParamReturnValue
qy(1).Direction = rdParamInput
qy(2).Direction = rdParamInput
qy(3).Direction = rdParamOutput
qy(1) = Now
qy(2) = Text1.Text
qy.Execute
Debug.Print qy(3)
End Sub
Private Sub Command2_Click()
Dim strSQL As String
Dim rs As rdoResultset
strSQL = "{CALL InputBLOBTest2('" & Now & "','" & Text1.Text & "')}"
Set rs = cn.OpenResultset(strSQL)
Debug.Print rs(0)
End Sub
Private Sub Form_Load()
Dim strSQL As String
cn.CursorDriver = rdUseOdbc
cn.Connect = "Driver={SQL server};" _
& "Server=MyServer;Database=Pubs;Uid=<username>;Pwd=<strong password>"
cn.EstablishConnection rdDriverNoPrompt
On Error Resume Next
strSQL = "DROP TABLE dbo.BLOBTest"
cn.Execute strSQL, rdExecDirect
On Error GoTo 0
strSQL = "CREATE TABLE dbo.BLOBTest "
strSQL = strSQL & "(ID int IDENTITY NOT NULL PRIMARY KEY, "
strSQL = strSQL & "WhenEntered Varchar(30), Comment TEXT)"
cn.Execute strSQL, rdExecDirect
On Error Resume Next
strSQL = "DROP PROCEDURE dbo.InputBLOBTest"
cn.Execute strSQL, rdExecDirect
On Error GoTo 0
strSQL = "CREATE PROCEDURE dbo.InputBLOBTest "
strSQL = strSQL & "@WhenEntered Varchar(30), _
@Comment TEXT, @id Int OUTPUT
strSQL = strSQL & "AS Insert Into BLOBTest(WhenEntered, Comment) "
strSQL = strSQL & "Values(@WhenEntered, @Comment) "
strSQL = strSQL & "Select @id=@@Identity"
cn.Execute strSQL, rdExecDirect
On Error Resume Next
strSQL = "DROP PROCEDURE dbo.InputBLOBTest2"
cn.Execute strSQL, rdExecDirect
On Error GoTo 0
strSQL = "CREATE PROCEDURE dbo.InputBLOBTest2 "
strSQL = strSQL & "@WhenEntered Varchar(30), @Comment TEXT "
strSQL = strSQL & "AS Insert Into BLOBTest(WhenEntered, Comment) "
strSQL = strSQL & "Values(@WhenEntered, @Comment) "
strSQL = strSQL & "Select @@Identity"
cn.Execute strSQL, rdExecDirect
Command1.Caption = Command1.Caption & "(Repro)"
Command2.Caption = Command2.Caption & "(Workaround)"
End Sub
Private Sub Form_Unload(Cancel As Integer)
cn.Close
End Sub
Additional query words: kbdse kbDSupport kbVBp kbVBp500 kbVBp600 kbNoKeyWord
Keywords: kbprb KB178445