and add values into column according to sql result
i created datatable at design time using add new items>dataset
i only need to fetch value from database and insert into datatable
Can any one help
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Sandesh PatilPosted Apr 23, 2010, 8:50 AM
DataTable table = new DataTable();
bool ready = false;
try
{
string sql = "select * from table";
con = ConnectionManager.GetDatabaseConnection();
SqlCommand cmd = new SqlCommand(sql, con);
cmd.CommandType = System.Data.CommandType.Text;
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.Fill(table);
if (table.Rows.Count > 0)
{
ready = true;
}
}
I think this will help u....
Sam HobbsPosted Apr 15, 2010, 3:15 PM
Hirendra SisodiyaPosted Apr 15, 2010, 3:12 AM
dataset is the collection of datatable, if you have created dataset form database on design time, you can use dataset1.Tables[0] term as datatable.....and perform your task..
thanks
Please mark as answere if it helps