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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 VB DataEnvironment using SQL Server

Author  Topic 

Dominic29
Starting Member

9 Posts

Posted - 2004-11-01 : 16:08:58
Hi,

I'm using VB DataEnvironment to interface a SQL Server database for reporting. I've created a Stored Proc which return a recordset of the data I want to print and I added it to the DataEnvironment. The SP have a parameter. When I execute the SP, it works fine in Query Analyzer. So I builded my DataReport and put this SP as DataMember. So far so good. When I execute the SP from my program, it return the recordset correctly but when I want to show the report, I get the error: "failed getting rowset from current data source". The SP doesn't seem to get the parameter... But it work when I call the SP directly from the connection object with the parameter I need. So my question is, how can I pass my parameter at run-time to the Stored Proc in my DataEnvironment??

thanks a lot for your time

jen
Master Smack Fu Yak Hacker

4110 Posts

Posted - 2004-11-01 : 21:34:00
in data environment, you have a property box wherein you can create a parameter to pass, else try to place a question mark (?) for the field criteria in your query.

--------------------
keeping it simple...
Go to Top of Page

Dominic29
Starting Member

9 Posts

Posted - 2004-11-02 : 13:48:06
The query work with the parameter when I call it directly from the VB program. The problem is when I want to associate the DataReport with the Stored Proc. My SP will return all the fields I need on the report, but need to be call with the correct parameter... If I set the DataMember property with the SP, the SP will be call with the "default" parameter, but I need to set this parameter dynamically, at run-time. Any idea how I can do it?

thanks
Go to Top of Page

jen
Master Smack Fu Yak Hacker

4110 Posts

Posted - 2004-11-02 : 22:21:05
i can't see your problem, can you post the code wherein you're calling the sproc? or you can follow this simple step:

1. add the dataenvironment
2. add command with parameters
3. add data report
4. assign the data source and data member to dataenvironment1 and command1, respectively.
5. then type this code where you're invoking the report from

DataEnvironment1.Command1 param1,param2,...
DataReport1.Show

--------------------
keeping it simple...
Go to Top of Page

Dominic29
Starting Member

9 Posts

Posted - 2004-11-03 : 16:27:06
That's exactly what I'm doing right now. See:

MyConnexion.SP_QCRap_sel (szPallet)

DR_QC.Orientation = rptOrientLandscape
DR_QC.Show vbModal

But I still get that damn error every time. But if I hardcode a valid parameter, the DataReport display correctly....
Go to Top of Page

jen
Master Smack Fu Yak Hacker

4110 Posts

Posted - 2004-11-03 : 22:03:15
quote:
Originally posted by Dominic29

That's exactly what I'm doing right now. See:

MyConnexion.SP_QCRap_sel (szPallet)

DR_QC.Orientation = rptOrientLandscape
DR_QC.Show vbModal

But I still get that damn error every time. But if I hardcode a valid parameter, the DataReport display correctly....



remove the parentheses in your call to sp_qcrap_sel .

data environment is really a gui stuff, can you post or atleast email me the screen captures so i can help you further? include: command properties (where you set the parameters), report properties

--------------------
keeping it simple...
Go to Top of Page

Dominic29
Starting Member

9 Posts

Posted - 2004-11-04 : 14:51:36
I've solved the problem finally!! It appears the Connexion object was closed before the DataReport.Show method call. Look like an error "code 12". 12 inches behind the keyboard! thanks a lot for your help and time, I really appreciate! :-)
Go to Top of Page
   

- Advertisement -