Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > How to get a dynamic temp table into a 2003 .NET dataset

Reply
Thread Tools

How to get a dynamic temp table into a 2003 .NET dataset

 
 
mrflynn@gmail.com
Guest
Posts: n/a
 
      07-08-2008
Hi all,

I'm trying to use a SQL Server 2005 stored procedure in Visual Studio
2003 and am running into problems. The stored proc creates a temp
table dynamically where the number of columns and column names change
depending on the passed parameters.

The stored proc runs fine in SSMS. From the .NET side, all I want to
do is use the stored proc to create a csv download of the information
returned.

Any help is appreciated. Thanks.

-Orcabelle
 
Reply With Quote
 
 
 
 
Cowboy \(Gregory A. Beamer\)
Guest
Posts: n/a
 
      07-08-2008
Get the return as a generic dataset and you can output rather easily by
looping through rows and columns. Something like this (have not checked
validity of the items in this code, so you will have to tweak it):

foreach(DataRow row in ds.Tables[0].Rows)
{
foreach(DataColumn column in ds.Tables[0].Columns)
{
string valueToOutput = row[column.ColumnName];
}
}

You can output to a StringBuilder if you have to display as well as save.
For save only, you can output directly to a writer. To have the user
download, link to the file you have created. Guids are good for guaranteed
uniqueness.

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

Subscribe to my blog
http://gregorybeamer.spaces.live.com/lists/feed.rss

or just read it:
http://gregorybeamer.spaces.live.com/

********************************************
| Think outside the box! |
********************************************
<(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi all,
>
> I'm trying to use a SQL Server 2005 stored procedure in Visual Studio
> 2003 and am running into problems. The stored proc creates a temp
> table dynamically where the number of columns and column names change
> depending on the passed parameters.
>
> The stored proc runs fine in SSMS. From the .NET side, all I want to
> do is use the stored proc to create a csv download of the information
> returned.
>
> Any help is appreciated. Thanks.
>
> -Orcabelle


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
copying a datatable content from an untyped dataset into a table which is inside a typed dataset Nedu N ASP .Net 2 10-31-2003 01:05 PM
Ccopying a datatable content from an untyped dataset into a table which is inside a typed dataset Nedu N ASP .Net Datagrid Control 2 10-31-2003 02:43 AM
Ccopying a datatable content from an untyped dataset into a table which is inside a typed dataset Nedu N ASP .Net 1 10-31-2003 02:39 AM



Advertisments