title: Select data from table1 and copy it to table2
body: <p>I am a real novice in c#.</p>
  
  <p>I have seen many questions like this over here. But, on trying, I could not get my code.</p>
  
  <p>I want all the columns of a row to be retrieved and then transfer it to another table of same database.</p>
  
  <p>So basically, retrieve data from <code>table1</code> and copy it to the respective columns of <code>table2</code>.</p>
  
  <p>I have tried this much code.
  And I am confused as how to call directly check string instead of defining each column in str1 string in the " ".</p>
  
  <pre><code> string check = "select * from custdetails where billid = @billid ";
  
           SqlCommand cmd1 = new SqlCommand(check , conn);
          cmd1.Parameters.AddWithValue("@billid", billid);
  
          DataSet ds = new DataSet();
          SqlDataAdapter da = new SqlDataAdapter(cmd1);
          da.Fill(ds);
         // string str1;
          int count = ds.Tables[0].Rows.Count;
          if (count &gt; 0)
          {
              string str1 = ds.Tables[0].Rows[0][""].ToString();
          }
  </code></pre>
  
  <p>I really dont have much idea about c#.
  Thanks for help.</p>