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
How can we perform transactions in .net?
What connected data?
How would you connect to a database by using .NET?
What are the disadvantages of using datalist?
Which is faster ado.net or linq?
What are the benefits of using of ADO.NET in .NET 4.0?
What is basic use of data view?
Explain what is datagrid with an example?
Which ado.net object is very fast in getting data from the database?
What is the difference between sqlcommand and sqldataadapter?
Which is faster datareader or dataadapter?
Give an example that shows how to execute a stored procedure in ado.net?
What is ole access?
If a table contains 20000 records . In a page at each time 100 records to be displayed what are the steps you will take to improve performance? Will you use dataset or datareader?
Which method is used to sort the data in ADO.Net?