Sequence to connect and retrieve data from database useig
dataset ?

Answer Posted / ramakrushna

SqlConnection con = new SqlConnection();
con.ConnectionString = "server=munapc;
database=project1; User ID=sa; Password=niit";
con.Open();

string query = "select * from emp";
SqlDataAdapter da = new SqlDataAdapter(query, con);
SqlCommandBuilder cmd = new SqlCommandBuilder(da);
DataTable dt = new DataTable();
da.Fill(dt);
dataGridView1.DataSource = dt;

con.Close();

Is This Answer Correct ?    2 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the namespaces used in ADO.Net to connect to a database?

591


Which components of a data provider is used to retrieve, insert, delete, or modify data in a data source?

612


What is microsoft ole db provider for sql server?

474


Describe connection object in ado.net

535


How can we serialize the dataset object?

555






What is namespace in ado.net?

494


Explain the two fundamental objects in ado.net?

497


What is the return type of executescalar?

489


What are the parameters that control most of connection pooling behaviors?

506


What is a dynaset in access?

518


What are three methods for displaying data in a syncfusion datagrid

608


What is the difference between the clone() and copy() methods of the dataset class?

540


What is datasource in ado.net?

577


What is the use of SqlCommand object?

637


how you will deal result set? How do you sort a dataset?If a dataset contains 100 rows, how to fetch rows between 5 and 15 only?

573