st@rter
پنج شنبه 28 خرداد 1394, 22:52 عصر
کد های که نوشته شده به صورت زیر هستش
public partial class UserControl_Register : System.Web.UI.UserControl
{
SqlConnection con1 = new SqlConnection("Data Source=.;Initial Catalog=WebDataBase;Integrated Security=True");
SqlCommand c1 = new SqlCommand();
protected void Page_Load(object sender, EventArgs e)
{
divPageMessage.Visible = false;
}
protected void btnRegister_Click(object sender, EventArgs e)
{
try
{
con1.Open();
c1.Connection = con1;
c1.CommandText = "insert into sabtnam(FirstNme,LastName,Email,UserName,Password, Passwordr)values('" + txtFirstName.Text + "','" + txtLastName.Text + "','" + txtEmail.Text + ",'" + txtusername.Text + ",'" + txtPassword.Text + ",'" + txtconfrimpassword.Text + "')";
c1.ExecuteNonQuery();
con1.Close();
divPageMessage.Visible = true;
Label1.Text = "اطلاعات ثبت شد";
txtFirstName.Text = "";
txtLastName.Text = "";
txtEmail.Text = "";
txtusername.Text = "";
txtPassword.Text = "";
txtconfrimpassword.Text = "";
}
catch (Exception ex)
{
divPageMessage.Visible = true;
Label1.Text = "خطا:" + ex.Message;
}
}
وقتی روی دکمه ثبت نام کلیک میکنم خطای زیر رو میده
خطا:Incorrect syntax near 'hesam'. Unclosed quotation mark after the character string ')'.
public partial class UserControl_Register : System.Web.UI.UserControl
{
SqlConnection con1 = new SqlConnection("Data Source=.;Initial Catalog=WebDataBase;Integrated Security=True");
SqlCommand c1 = new SqlCommand();
protected void Page_Load(object sender, EventArgs e)
{
divPageMessage.Visible = false;
}
protected void btnRegister_Click(object sender, EventArgs e)
{
try
{
con1.Open();
c1.Connection = con1;
c1.CommandText = "insert into sabtnam(FirstNme,LastName,Email,UserName,Password, Passwordr)values('" + txtFirstName.Text + "','" + txtLastName.Text + "','" + txtEmail.Text + ",'" + txtusername.Text + ",'" + txtPassword.Text + ",'" + txtconfrimpassword.Text + "')";
c1.ExecuteNonQuery();
con1.Close();
divPageMessage.Visible = true;
Label1.Text = "اطلاعات ثبت شد";
txtFirstName.Text = "";
txtLastName.Text = "";
txtEmail.Text = "";
txtusername.Text = "";
txtPassword.Text = "";
txtconfrimpassword.Text = "";
}
catch (Exception ex)
{
divPageMessage.Visible = true;
Label1.Text = "خطا:" + ex.Message;
}
}
وقتی روی دکمه ثبت نام کلیک میکنم خطای زیر رو میده
خطا:Incorrect syntax near 'hesam'. Unclosed quotation mark after the character string ')'.