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
 Transact-SQL (2000)
 display data in dtagrid from stored procedure

Author  Topic 

NitinSL
Starting Member

2 Posts

Posted - 2005-01-16 : 01:45:49
Hi All!

I have a datagrid in my ASP.net form, in which i have to display data coming from a Stored Procedure.
My stored procedure has multiple select statements.On execution of my ASP.net form , an error crops up that reads "field name StartDate does not exist". where StartDate comes from my second select statement in stored procedure.
Only the first select statement results are being displayed whereas QA gives appropriate results.
Is there any way i can bind my datagrid column to the values retrieved from the second select statement?

saglamtimur
Yak Posting Veteran

91 Posts

Posted - 2005-01-16 : 04:53:28
If you have multiple select statements in one stored prod., that means that you have multiple tables returned. A dataset can hold multiple tables, and automaticly naming them like Table, Table1 etc. Those names are given in the order of select statements. So your firs select will be in ds.tables(0) and the second one will be in ds.tables(1). If you want to bind second select statement to datagrid you must use like datagrid1.datasource=ds.tables(1) and then datagrid1.databind(). Hope this helps.
Go to Top of Page
   

- Advertisement -