borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Previous Topic (data aware class)Next Topic (Stored  procedures with parameters using OLE DB) New Topic New Poll Post Reply
AndreaVB Forum : Database : stored procedures
Poster Message
sid
Level: Guest


icon stored procedures  Archived to Disk

How To Use stored procedures in data report ?

09-05-2002 at 10:53 AM
| Quote Reply
JLRodgers
Level: Moderator

Registered: 04-04-2002
Posts: 1617
icon Re: stored procedures  Archived to Disk

If you mean, the DataReport and DataEnvironment built into VB (DataProject). Then you just:
1) select the connection, go to properties, enter all the proper information.
2) Add a command
(To see if any procedures exist)
3a) select stored procedure, then see if the procedure exists
3b) Use the SQL statement, enter the procedure name, followed by the parameter.

Now as far as dynamically... You can try to modify the command via code like the following:

DataEnvironment1.rsCommand1.Source = "StoredProcedure Parameters"
DataEnvironment1.rsCommand1.Open

Or use a temp table.

IE. Create the SQL command to get the results, then insert the results into a temporary table, then have a command and report just display the results from the temp table, not the original command. Then clear the temp table.

09-05-2002 at 05:34 PM
View Profile Send Email to User Show All Posts Visit Homepage | Quote Reply
sid
Level: Guest

icon Re: stored procedures  Archived to Disk

Thanks For answering .But How Do I use the stored procedure to display in the form of report.

10-05-2002 at 01:02 PM
| Quote Reply
JLRodgers
Level: Moderator

Registered: 04-04-2002
Posts: 1617
icon Re: stored procedures  Archived to Disk

In the data reoprt properties:

DataSource = DataEnvironment
DataMember = Whatever pops upin the box (the SQL statements, commands etc).

10-05-2002 at 08:35 PM
View Profile Send Email to User Show All Posts Visit Homepage | Quote Reply
JLRodgers
Level: Moderator

Registered: 04-04-2002
Posts: 1617
icon Re: stored procedures  Archived to Disk

Then you have to right click the report, click retrieve structure.

Open up the connection form, expand the procedure and drag the fields to the report, or just drag the command to the report.

(edit message still doesn't work)

10-05-2002 at 08:37 PM
View Profile Send Email to User Show All Posts Visit Homepage | Quote Reply
sid
Level: Guest

icon Re: stored procedures  Archived to Disk

hi thanks for answering.but i am still not able to get it.actually i have a stored procedure with having in out parameters & i am trying to use that in the data report .so i tried all that u suggested but yet i am not getting it.

12-05-2002 at 05:20 PM
| Quote Reply
JLRodgers
Level: Moderator

Registered: 04-04-2002
Posts: 1617
icon Re: stored procedures  Archived to Disk

If you can get just a plain table to work with the data report (displaying and everything)... Then I don't have any ideas as to why it doesn't work.

I have one last idea before giving up:
1) On the connection, you have a command,SQL statement or something that's used to open the procedure.
2) Select the properties
3) click on Advanced
4) Make sure "Recordset Returning" is selected
5) Accept, close the dialog
6) Select the same item in step 1
7) Select "Design"
8) You have the SQL command that'll be executed, Right click in the top pane (you need the menu with "Run" in it)
9) Click "run"
10) if you see the results you expect, then I have no clue, if you don't, modify the SQL statement as to get the results you're expecting and try the report again. (when you close the designer, it'll ask if you want to save the changes)

Like I said, if the above doesn't do anything, I have no other ideas. Good luck.

12-05-2002 at 10:50 PM
View Profile Send Email to User Show All Posts Visit Homepage | Quote Reply
AndreaVB Forum : Database : stored procedures
Previous Topic (data aware class)Next Topic (Stored  procedures with parameters using OLE DB) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder