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
Which object of ado contains datarow datacolumn collection?
What is the difference between Optimistic and Pessimistic locking?
What is executequery?
Why ca not we use multiple inheritance and garbage collector paralelly in .net?
Is bulk insert faster than insert?
Describe briefly an ADO.NET Dataset ?
What is Data Provider?
What are the types of databinding?
How to copy the contents from one table to another table and how to delete the source table in ado.net?
What provider ado.net use by default? Explain the role of data provider in ado.net?
Why edit is not possible in repeater?
What is difference between datatable and dataset?
What is method to get XML and schema from Dataset? getXML() and get Schema ()
What is meant by ‘transaction’ in a database and what are the ‘properties of transaction’?
What is bubbled event?