سلام دوستام مشکل این کد چیه چرا به خط 36 گیر میده؟ من میخوام تو دیتا بیس سرچ کنم که کاربر هست یا نیست .
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
public partial class pages_Register : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
string strcon = "Data Source=DANI;Initial Catalog=pic_gallery;Integrated Security=True";
SqlConnection con = new SqlConnection(strcon);
if(TextBox1.Text == "" || TextBox2.Text == "" || TextBox3.Text == "")
{
Label5.Text = "لطفا فیلد های زیر را پر کنید";
Label5.ForeColor = Color.Red;
Label5.Visible = true;
}
else
{
if(TextBox2.Text == TextBox3.Text )
{
SqlDataAdapter da = new SqlDataAdapter("select * from user_TBL where user_name=" + TextBox1.Text ,strcon);
DataTable dt = new DataTable();
da.Fill(dt);
if(dt.Equals(TextBox1.Text ))
{
Label5.Text = "این نام کاربری موجود است";
Label5.ForeColor = Color.Red;
Label5.Visible = true;
}
else
{
SqlCommand com = new SqlCommand("insert into user_TBL (user_name,pasword,email) values ('" + TextBox1.Text + "','" + TextBox2.Text + "','" + TextBox4.Text + "')", con);
con.Open();
com.ExecuteNonQuery();
con.Close();
Label5.Text = "ثبت نام با موفقیت انجام شد";
Label5.ForeColor = Color.Green;
Label5.Visible = true;
}
}
else
{
Label5.Text = "پسورد های وارد شده یکسان نمی باشند";
Label5.ForeColor = Color.Red;
Label5.Visible = true;
}
}
}
}