General discussion

Locked

Use Cursor Data Type of SQLServer in VB

By mihir_gandhi ·
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 conversation is currently closed to new comments.

2 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

Use Cursor Data Type of SQLServer in VB

by a_schwarze In reply to Use Cursor Data Type of S ...

you need to set the nocount-setting of your sql-server to on. to do this add the line "set nocount on" to the top of your StoredProcedure (and change it back at the end with "set nocount off"
HTH
Andreas

Collapse -

Use Cursor Data Type of SQLServer in VB

by mihir_gandhi In reply to Use Cursor Data Type of S ...

I am using the same set nocount off

Back to Web Development Forum
2 total posts (Page 1 of 1)  

Related Discussions

Related Forums