How to read a Dataset

Results 1 to 2 of 2

Thread: How to read a Dataset

  1. #1
    Join Date
    Dec 1969

    Default How to read a Dataset

    I have populated a dataset using sqladapter and now the dataset contains one record. So how can I manage to read the value of each column in this dataset using response.write, Actually I am trying to insert these values in another table, so I don't won't to view the values on the screen.

  2. #2
    Join Date
    Dec 1969

    Default RE: How to read a Dataset

    here is one method to write the dataset values...<BR><BR>step1- code to make the connection to the database<BR> con1=new SqlConnection("server=web-server;database=vbc;user id=sa;password=sa");<BR> con1.Open();<BR> String check="select * from logininfo";<BR> da=new SqlDataAdapter(check,con1);<BR> ds=new DataSet();<BR> da.Fill(ds,"userdata");<BR>step2--try this code to clear ur doubt<BR> for(int i=0; i&#060;ds.Tables["userdata"].Rows.Count; i++)<BR> {<BR> Response.Write(ds.Tables["userdata"].Rows[i]["mem_id"].ToString(); //here mem_id is the field in the database<BR> }<BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts