hello;
how we can create dataset of existing table in sqlserver2000 using c# n asp.net. because my application is based on crystal reporting.
regards,
sumaira
How we can create dataset of existing table in sqlserver2000 using c# n asp.net
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.


Krishna GaradRank #191 · 12.8K reputationPosted Jan 27, 2012, 11:32 PM EST
Private DataSet CreateDS()
{
//connection object
SqlConnection cn=new SqlConnection("U r ConnectionString");
//command object
SqlCommand cmd=new SqlCommand("Select * from TableName",cn);
//create dataset
DataSet ds=new DataSet();
//call adapter
SqlDataAdapter da=new SqlDataAdapter(cmd);
//fill the dataset
da.Fill(ds);
return ds;
}
I hope this will help you.
Sam HobbsRank #107 · 20.5K reputationPosted Jan 28, 2012, 5:52 PM EST