Sequence to connect and retrieve data from database useig
dataset ?
Answer Posted / a.anwar sadat
public SqlConnection con = new SqlConnection("server=anwar;
uid=sa; pwd=s;database=Employee;");
public SqlCommand cmd;
public SqlDataAdapter da;
public DataSet ds;
cmd = new SqlCommand("select * from empdetails", con);
da = new SqlDataAdapter(cmd);
ds = new DataSet();
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 ? | 13 Yes | 6 No |
Post New Answer View All Answers
How to pass values into a datatable?
What is the difference between ado.net and entity framework?
If we are not returning any records from the database, which method is to be used?
How do you implement locking concept for dataset?
What is execute scalar in ado.net?
What is ado code?
In how many ways we can retrieve table records count? How to find the count of records in a dataset?
Give few examples of datareader that is used in different dataproviders.
What is executenonquery ado.net?
Which property is used to check whether a DataReader is closed or opened?
Which components of a data provider is used to retrieve, insert, delete, or modify data in a data source?
What do you know about ado.net's methods?
What do you mean by performing asynchronous operation using command object?
What is the difference between statement and preparedstatement interface?
What is full form of ado?