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
Explain the dataadapter class in ado.net?
Which database is the ado.net sql connection object designed for?
What is ado.net code?
Which is better entity framework or ado.net?
What are the types of databinding?
What property must be set and what method must be called in your code to bind the data from some data source to the Repeater control?
What is a column variable?
Which method is used by command class to execute SQL statements that return single value?
How to maintain the relation between two tables in ADO.NET?
What are the Features of a dataset
What is ado.net architecture?
How to retrieve the user id which is provided while windows authentication?
What is adodb dll?
Can you explain how to enable and disable connection pooling?
Name which operations can you not perform on an ado.net dataset?