Z
zleug
Guest
Hi All.
On online I found information related to my question. But I cannot understand what is dc in that line:
using (SqlConnection con = new SqlConnection(dc.Con)) {
Does that insert data to the table according specified stored procedure? Is that correct?
private void button1_Click(object sender, EventArgs e) {
using (SqlConnection con = new SqlConnection(dc.Con)) {
using (SqlCommand cmd = new SqlCommand("sp_Add_contact", con)) {
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@FirstName", SqlDbType.VarChar).Value = txtFirstName.Text;
cmd.Parameters.Add("@LastName", SqlDbType.VarChar).Value = txtLastName.Text;
con.Open();
cmd.ExecuteNonQuery();
}
}
}
Thanks.
Continue reading...
On online I found information related to my question. But I cannot understand what is dc in that line:
using (SqlConnection con = new SqlConnection(dc.Con)) {
Does that insert data to the table according specified stored procedure? Is that correct?
private void button1_Click(object sender, EventArgs e) {
using (SqlConnection con = new SqlConnection(dc.Con)) {
using (SqlCommand cmd = new SqlCommand("sp_Add_contact", con)) {
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@FirstName", SqlDbType.VarChar).Value = txtFirstName.Text;
cmd.Parameters.Add("@LastName", SqlDbType.VarChar).Value = txtLastName.Text;
con.Open();
cmd.ExecuteNonQuery();
}
}
}
Thanks.
Continue reading...