Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- string sqlText = "INSERT INTO Person VALUES ( '" + txtPersonId1.Text.Trim() + "',' " + txtPersonName1.Text + "'); ";
- sqlText += "INSERT INTO Person VALUES ( '" + txtPersonId2.Text.Trim() + "',' " + txtPersonName2.Text + "'); ";
- sqlText += "INSERT INTO Person VALUES ( '" + txtPersonId3.Text.Trim() + "',' " + txtPersonName3.Text + "'); ";
- sqlText += "INSERT INTO Person VALUES ( '" + txtPersonId4.Text.Trim() + "',' " + txtPersonName4.Text + "'); ";
- SqlConnection connection = new SqlConnection(connectionString);
- SqlCommand command = new SqlCommand(sqlText,connection);
- command.CommandType = CommandType.Text;
- connection.Open();
- int recordsInserted = command.ExecuteNonQuery();
- connection.Close();
- MessageBox.Show("Number of records affected : " + recordsInserted.ToString());
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement