devxlogo

Create and Retrieve a Named DataSet

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;}
See also  How to Avoid Money Transfer Scams  
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist