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 is read only and forward only in ado.net?

513


How does entity framework work?

464


How is it possible to get 2 tables of data at a time by using data reader?

496


Explain all the classes those are used for database connections between sql server and asp.net?

505


What is DataReader Object?

595






What is the return type of executescalar?

492


List the 4 common ado.net namespaces?

697


Can we load multiple tables in a dataset?

540


Why do we need ado.net?

540


What are the steps you will take to improve performance? Will you use dataset or datareader?

546


Explain the architecture of ado.net?

539


Explain the advantages and disadvantages of using datalist?

614


What are the ado.net connection pooling parameters?

461


What is a datareader object?

577


What is Serialization in .NET? what are the types of Serialization?

546