Posted By

ixia on 01/18/08


Tagged

ADONet using


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

umang_nine


Simple insert SPROC call


 / Published in: C#
 

  1. public void LogRequest(string requestor, string messageBody)
  2. {
  3. using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["MyConnectionString"].ConnectionString))
  4. {
  5. conn.Open();
  6. SqlCommand cmd = new SqlCommand("wp_InsertRequest", conn);
  7. cmd.CommandType = CommandType.StoredProcedure;
  8. cmd.Parameters.Add(new SqlParameter("Requestor", requestor));
  9. cmd.Parameters.Add(new SqlParameter("EmailBody", messageBody));
  10. cmd.ExecuteNonQuery();
  11. }
  12. }

Report this snippet  

You need to login to post a comment.