Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
JasonAnt
Starting Member
23 Posts |
Posted - 2007-08-27 : 09:33:02
|
| How can I get data from temp table into vb recordset ?I created a sp called sp_test, and hope it will return recordsetcreate proc sp_testas create table #list( code char(30), name char(200)) insert into #list ( code, name ) select Item, [Item Name] from tbItem select * from #listreturnIt works fine in Query Analyzer, now I try in VB 6.0Dim cn as new ADODB.connectionDim rs as new ADODB.recordsetcn.open .... rs.open "select * from sp_test",cntdbGrid1.datasource = rsvb cannot return recordset as I expected, whats wrong with my vb program?thanks |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2007-08-27 : 09:38:21
|
| rs.open "exec sp_test",cnorset rs = cn.Execute "sp_test"_______________________________________________Causing trouble since 1980blog: http://weblogs.sqlteam.com/mladenp |
 |
|
|
JasonAnt
Starting Member
23 Posts |
Posted - 2007-08-27 : 10:29:00
|
| Thanks spirit1,I've tried your code, now I get no error, but still cant get any dataif I put debug.print rs(0) bellow then rs.open, I get error message "Item cannot be found in the collection corresponding to the requested name or ordinal"and when I tried the other option, set rs = cn.exec "sp_test"I got error message syntax error, "expected end of statement"do I use the wrong references or what ? I am using Microsoft Activex Data Object 2.6The point of my question is, I need to do some complex calculation, store it in somewhere (temporary), display it in grid and maybe print it. Is there other solution ? |
 |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2007-08-27 : 10:40:03
|
| put set nocount on at the beginning of your sproc._______________________________________________Causing trouble since 1980blog: http://weblogs.sqlteam.com/mladenp |
 |
|
|
JasonAnt
Starting Member
23 Posts |
Posted - 2007-08-27 : 10:52:03
|
| Now it works, Thanks a lot Spirit1 |
 |
|
|
|
|
|
|
|