Simple insert SPROC call


/ Published in: C#
Save to your folder(s)



Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.