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 are the different ado.net namespaces are available in .net?
Explain how can we load multiple tables in to dataset?
Explain the difference between sqlcommand object and command behavior object?
What is a string variable?
What are the namespaces used in ADO.Net to connect to a database?
Why edit is not possible in repeater?
How do you implement locking concept for dataset?
Can datareader hold data from multiple tables?
What is ado in agriculture?
How to aggregating data across related tables?
How to bind the controls(best practice) comboboxes to the data in the dataset?
What are the methods of XML dataset object?
Give an example that shows how to execute a stored procedure in ado.net?
What is the current version of entity framework?
Which name space is used to get assembly details?