title: how to store datatable values in string variable in c#
body: <p>i have stored table values in datatable i want to store each value in string  variable.</p>
  
  <pre><code>using (SqlConnection con = new SqlConnection(connection))
  {      
      using (SqlCommand cmd = new SqlCommand("select top 1 * from tbl_invoice order by id desc", con))
      {
          if (con.State != System.Data.ConnectionState.Open)
          {
              con.Open();
          }
          DataTable dt = new DataTable();
          dt.Load(cmd.ExecuteReader());
          gvInvoice.DataSource = dt;
          gvInvoice.DataBind();
          gvInvoice.DataSource = dt;
          gvInvoice.DataBind();
          InvoiceNo = dt.TableName[0].ToString();
      }
  }
  </code></pre>