Sequence to connect and retrieve data from database useig
dataset ?
Answer Posted / reply2anwar
public SqlConnection con = new SqlConnection("server=anwar;uid=sa; pwd=s;database=Employee;");
public SqlCommand cmd;
public SqlDataAdapter da;
private void RetriveData()
{
cmd = new SqlCommand("select * from empdetails", con)
DataSet ds = new DataSet();
using(da = new SqlDataAdapter(cmd))
{
da.Fill(ds, "empdetails");
foreach(DataRow dr in ds.Tables["empdetails"].Rows)
{
txtempname.Text = dr["name"].ToString();
txtdob.Text = dr["dob"].ToString();
txtstreetname.Text = dr["street"].ToString();
} // foreach
}
}
| Is This Answer Correct ? | 1 Yes | 2 No |
Post New Answer View All Answers
Does dapper use ado.net?
What are two important objects of ADO.Net?
What is the use of SqlCommandBuilder?
What is Data Provider?
Define isolation?
What is the difference in record set and dataset?
How to load multiple tables into a dataset?
What is the procedure to call a Stored Procedure of Back End in ADO (ActiveX Data Object) and RDO (Remote Data Objects)?
Explain the namespaces in which .net has the data functionality class.
How does entity framework work?
What is fill method in ado.net?
How can we load multiple tables in a dataset?
What is difference between connected and disconnected architecture in ado.net?
What are the differences between OLEDB and SQLClient Providers?
What is a string variable?