Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to bind DataGrid Control to data brought with a SP.. 1

Status
Not open for further replies.

Jagger

IS-IT--Management
Nov 7, 2000
7
0
0
PE
Hi...
I have some data that I bring from DB with a Store Procedure, and I want to put them in a OLE DataGrid control. I was trying to do it using a Ado data control but I think ADODC doesn't support sp with parameters. Now, I 'm trying to do it using an ADO command and a recordset, like this:

Set cm = CreateObject("Adodb.Command")
cm.CommandText = "SP_CONSALDS"
cm.CommandType = adCmdStoredProc
cm.ActiveConnection = prmcnConexion
cm.Parameters.Refresh
cm(1) = param1
cm(2) = param2
Set rs=CreateObject("ADODB.Recordset")
rs.CursorType=adOpenKeyset
Set rs=cm.Execute
' finally
set Datagrid1.DataSource=rs
DataGrid1.Refresh

Unfortunatelly, after I execute the cm command, the cursor type property in rs back to 0 (Dynamic)...And in execution time I see the error: The Rowset is not bookmarkable

Are there somedoby that can help me? Thanks.
 
I used to get the same error too.

Then I created an explicit ADODC on the form, assigned the necessary properties and then bound the DataGrid to this ADODC, everything worked fine.

I am not sure if this is feasible with your problem or not, but just wanted to let you know.

- Subha Nothing is impossible, even the word impossible says I'm possible.
 
Thank you Subhavs...
I was trying to do that, but I cannot set the store procedure parameters to the ADODC...
How can I specify those parameters in an ADODC control?

Thanks again.
 
Jagger,

Gee... The SQL that I used was a normal query, I had not used stored procedures before.

But, I tried for while yesterday using stored procedures with explicit ADODC. Looks like there is no documentation for passing parameters.

As with the command object, I did find something amusing though. There is a BookMarkable property of this command object that needs to be set to true (cmd.Properties("BookMarkable") = true). This makes the 'Rowset is not bookmarkable' error to go away, but the grid does not get populated though.

This is a progress, but not satisfactory. My suggestion would be to open a trouble ticket with Microsoft and listen to what they have got to say.

Once you get the solution, I would like to know what it is. Could you please post a followup ?

Thanks,

- Subha Nothing is impossible, even the word impossible says I'm possible.
 
I think your solution can run, I will try with it... but, fortunatelly I have already found the solution and I want to comunicate that to you...
You have to write the same lines that I wrote at the beginning of this thread, but you set the rs.CursorLocation = adUseClient before you execute the command...Also, previously, you have to open the connection with its CursorLocation at the client side (prmcnConexion.CursorLocation=adUseClient)... I did that and my code finally run...

Thanks.
 
Thanks Jagger, for the followup. It worked !!

- Subha :) Nothing is impossible, even the word impossible says I'm possible.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top