Use Cursor Data Type of SQLServer in VB - TechRepublic
General discussion
July 5, 2001 at 07:11 PM
mihir_gandhi

Use Cursor Data Type of SQLServer in VB

by mihir_gandhi . Updated 24 years, 10 months ago

Dear Friends,

I am using Visual Basic 6,ADO 2.6,SQL Server 2000. When i execute a stored procedure from vb, which returns Cursor Data Type.

sample:-
Dim conGetUserNames As New ADODB.Connection
Dim cmdGetUserNames As New ADODB.Command
Dim rsGetUserNames As New ADODB.Recordset

rsGetUserNames.CursorLocation = adUseClient
rsGetUserNames.CursorType = adOpenKeyset

Set conGetUserNames = objEnum.OpenMainConnection

With cmdGetUserNames
Set .ActiveConnection = conGetUserNames
.CommandText = “{call umtest.getoptuname(?,?,?,?,?,?,?)}”
.CommandType = adCmdText

.Parameters(0).Direction = adParamInput
.Parameters(1).Direction = adParamInput
.Parameters(2).Direction = adParamInput
.Parameters(3).Direction = adParamInput
.Parameters(4).Direction = adParamInput
.Parameters(5).Direction = adParamOutput
.Parameters(6).Direction = adParamOutput

.Parameters(0).Value = “mihir”
.Parameters(1).Value = “mihir”
.Parameters(2).Value = “gandhi”
.Parameters(3).Value = #02/12/1977#
.Parameters(4).Value = “India”

.Parameters(5).Type = adNumeric
.Parameters(6).Type = adLongVarChar

Set rsGetUserNames = .Execute
‘The above code doesnot generates any error but when i check the recordset it shows the following error.

Error :-
——–
ErrNo:- 3704
Description:-
Operation is not allowed when the object is closed.

Waiting for yr earliest solution.

Mihir

This discussion is locked

All Comments