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
What is ole db and odbc?
What does datareader object do?
What are the namespaces used in ADO.Net to connect to a database?
How does entity framework work?
What is connected architecture in ado.net?
Explain the basic use of "dataview" and explain its methods.
What does executereader return?
What is a string variable?
differences between ADO and ADO.NET
What are typed and untyped dataset?
What are the data access namespaces in .NET?
What is ado data control?
What are the Features and disadvantages of dataset
How to perform sorting on a table in ADO.NET?
Describe ado.net object model in detail.