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
Is ado.net dead?
What is the usage of the dataset object in ado.net?
What is serialization and de-serialization in .net?
What is the difference between oledb sql server and oledbdotnet provider?
Does executenonquery return a value?
What is ole2 format?
Does sqlclient and oledb class share the same functionality?
How to add a javaScript function in a datagrid?
What is ado.net components?
What is sql connection in ado.net?
Why edit is not possible in repeater?
What is ole in excel?
What is ado asp?
What is the difference between dataset and datatable?
What are advantages of microsoft-provided data provider classes in ado.net?