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

Give an example of a .net application which connects to microsoft access database using ado.net classes.

819


What is ado code?

730


Explain the advantage of ADO.Net?

767


What is the difference between ado.net and entity framework?

804


The answers which posted above is not satisfied my requirement? Can some one post teh exact answer? Thanx

1817


What is the use of adodc?

751


What is sqldatareader?

690


What is the difference between Datareader and Dataset?

782


What is ado.net objects?

726


What is meant by ‘transaction’ in a database and what are the ‘properties of transaction’?

781


How do we use stored procedure in ADO.NET and how do we provide parameters to the stored procedures?

792


Which object is used to add relationship between two Datatables?

809


What is ambient transaction?

709


Describe datareader object of ado.net with example.

719


What is partial class?

749