4
Answers

An expression of non-boolean type specified in a context whe

Thiyaga Raja

Thiyaga Raja

11y
2.2k
1
I have created registration.aspx page. the Code behind file is given below...

protected void Page_Load(object sender, EventArgs e)
    {
        if (IsPostBack)
        {
            SqlConnection con = new SqlConnection("Data Source=THIYAGU-PC\\SQLEXPRESS;Initial Catalog=SriSri;Integrated Security=True");
            con.Open();
            string cmdstr = "select count(*) from Registration where '" + TextBoxUN.Text + "' ";
            SqlCommand cmd = new SqlCommand(cmdstr, con);
            int temp = Convert.ToInt32(cmd.ExecuteScalar().ToString());
            con.Close();
            if (temp == 1)
            {
                Response.Write("User Name Already Exist.....!!! <br> Please Try Some other User Name....!!!");
            }
        }
    }

This is my table for Registration.aspx page.

CREATE TABLE [dbo].[Registration](
    [UserId] [int] NOT NULL,
    [UserName] [nvarchar](20) NULL,
    [Password] [nvarchar](15) NULL,
    [EmailAddress] [nvarchar](50) NULL,
    [FullName] [nvarchar](50) NULL,
    [Country] [char](10) NULL,
)

while executing error has coming like this...
An expression of non-boolean type specified in a context where a condition is expected, near 'HBHBH'.

How to find the solution.kindly any one help me to do this process..

Thank u so  much....



Answers (4)