title: How to insert data into a sql data table via stored procedure
body: <p>I want to insert data from a dataset in asp.net into a SQL Server table.</p>
  
  <p>But I can't pass the values from dataset to my stored procedure plz help me</p>
  
  <p>Here is my code</p>
  
  <pre><code>private static SqlCommand WriteDatabase(SqlConnection conn)
  {
              SqlCommand cmd = new SqlCommand(SP_insertData);
              cmd.Parameters.Clear();
              cmd.CommandType = CommandType.StoredProcedure;
              SqlParameterCollection pc = cmd.Parameters;
  
              pc.Add(CreateParameter("abID", System.Data.SqlDbType.Int));
              pc.Add(CreateParameter("fHitType", System.Data.SqlDbType.Int));
              pc.Add(CreateParameter("DateOfHit", System.Data.SqlDbType.DateTime));
              pc.Add(CreateParameter("TimeOfHit", System.Data.SqlDbType.Int));
              pc.Add(CreateParameter("fEmpid", System.Data.SqlDbType.Int));
  
              cmd.ExecuteNonQuery();
  
              return cmd;
  }
  
  private static SqlParameter CreateParameter(string p, SqlDbType sqlDbType)
  {
          SqlParameter parameter = new SqlParameter("@" + p, sqlDbType);
          parameter.SourceColumn = p;
          return parameter;
  }
  </code></pre>
  
  <p>I can't pass values from dataset to my stored procedure</p>