Create and Retrieve a Named DataSet

This C# function creates and retrieves a named DataSet using an open connection and a command.

public System.Data.DataSet dsReturnedDataSetFrom(System.Data.SqlClient.SqlConnectionsqlOpenConn, System.Data.SqlClient.SqlCommand TheSQLCommand, string TheQueriedTable, stringTheDatasetName){TheSQLCommand.Connection = sqlOpenConn;System.Data.SqlClient.SqlDataAdapter NewDA = new System.Data.SqlClient.SqlDataAdapter(TheSQLCommand);DataSet NewDS = new DataSet();TheDatasetName.Trim();NewDS.DataSetName=TheDatasetName;NewDA.Fill(NewDS, TheQueriedTable);NewDA.Dispose();return NewDS;}
Share the Post:
Share on facebook
Share on twitter
Share on linkedin

Overview

Recent Articles: