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
What is typed dataset ?
Can we load multiple tables in a dataset?
Which object needs to be closed?
What is bubbled event can you please explain?
What is dbcontext and dbset in entity framework?
What are the ado.net objects?
What is ole used for?
What is difference between executenonquery and executequery?
What is a datareader object?
What is ado data control?
What is data view and variable view?
What are the different ado.net namespaces are available in .net?
How to enable and disable connection pooling?
What is oledb connection?
What is connection string?