Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
3
Reply
Ideal way to retrive dataset.
Jigar Desai
Jul 12 2004 2:48 PM
8.6k
Reply
This is DataSet retriving code from
IBUYSPY
Events Module. public DataSet GetEvents(int moduleId) { // Create Instance of Connection and Command Object SqlConnection myConnection = new SqlConnection(ConfigurationSettings.AppSettings["connectionString"]); SqlDataAdapter myCommand = new SqlDataAdapter("GetEvents", myConnection); // Mark the Command as a SPROC myCommand.SelectCommand.CommandType = CommandType.StoredProcedure; // Add Parameters to SPROC SqlParameter parameterModuleId = new SqlParameter("@ModuleId", SqlDbType.Int, 4); parameterModuleId.Value = moduleId; myCommand.SelectCommand.Parameters.Add(parameterModuleId); // Create and Fill the DataSet DataSet myDataSet = new DataSet(); myCommand.Fill(myDataSet); // Return the DataSet return myDataSet; } My Question is 1) Is this ideal way to retrive data? 2) Will it return connection back to pool?
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
3
)
Next Recommended Forum
Committing changes from bounded Windows Form controls
how to transfer data from excel to sql server table