Sequence to connect and retrieve data from database useig
dataset ?
Answer Posted / pushpendra singh
step 1---// Connection creation using Connection string
to connect SQL database
SqlConnection conn=new SqlConnection("data
source=server_name;initial catalog=database_name;integrated
security=sspi");
conn.Open();
step2----execute command using SqlCommand Class.
SqlCommand cmd=new SqlCommand("select * from asd",conn);
DataSet ds=new DataSet();
SqlDataAdapter da=new DataAdapter();
da.SelectCommand=cmd;
//insert data from dataadapter to dataset
da.Fill(ds);
dataGridView1.DataSource=ds.Tables[0];
conn.Close();
| Is This Answer Correct ? | 1 Yes | 2 No |
Post New Answer View All Answers
Why edit is not possible in repeater?
What is bubbled event can you please explain?
What are all the commands used with Data Adapter?
What is difference between entity framework and ado.net?
What is disconnected data?
What is the difference between executequery and executenonquery?
Define isolation?
Does executenonquery return a value?
What is shadow copy?
What are the different row versions available in table?
Why ca not we use multiple inheritance and garbage collector paralelly in .net?
What does executequery return?
What are the features of ado.net?
What is the meaning of executenonquery?
What is difference between Dataview and Datatable?