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 bulk insert faster than insert?
Does executenonquery return a value?
What is difference between executequery and executeupdate?
How to enable and disable connection pooling?
What are three methods for displaying data in a syncfusion datagrid
What provider ado.net use by default? Explain the role of data provider in ado.net? What is the role of data provider in ado.net?
What are different layers of ADO.Net?
Which is the feature of ado.net?
Explain About ado.net components/objects. Usage of data adapters and tell the steps to retrieve data.
How do you merge 2 datasets into the third dataset in a simple manner?
What is difference between ado and other data object?
How to store data in memory?
What is csdl entity framework?
Do we use stored procedure in ADO.Net?
What is the use of sqldatareader class?