none
login page error RRS feed

  • Question

  • This is my program:

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Data.SqlClient;
    using System.Configuration;

    public partial class login : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }
        protected void Button_Login_Click(object sender, EventArgs e)
        {
            SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["RegistrationConnectionString"].ConnectionString);
                conn.Open();
                string checkuser = "select count(*) from Table where User_Name='" + TextBoxUserName.Text + "'";
                SqlCommand com = new SqlCommand(checkuser, conn);
                int temp = Convert.ToInt32(com.ExecuteScalar().ToString());
                conn.Close();
                if (temp == 1)
                {
                    conn.Open();
                    string checkPasswordQuery = "select password from Table where User_Name='" + TextBoxUserName.Text + "'";
                    SqlCommand passcom = new SqlCommand(checkPasswordQuery, conn);
                    string password = passcom.ExecuteScalar().ToString();
                    if (password == TextBoxPassword.Text)
                    {
                        Session["New"] = TextBoxUserName.Text;
                        Response.Write("Password is correct");
                    }
                    else
                    {
                        Response.Write("Password is not correct");
                    }
                }
                else
                {
                    Response.Write("UserName is not correct");



                }

        }
    }

    Im getting the error below:

    Server Error in '/' Application.

    Incorrect syntax near the keyword 'Table'.

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

    Exception Details: System.Data.SqlClient.SqlException: Incorrect syntax near the keyword 'Table'.

    Source Error: 
    Line 20:             string checkuser = "select count(*) from Table where User_Name='" + TextBoxUserName.Text + "'";
    Line 21:             SqlCommand com = new SqlCommand(checkuser, conn);
    Line 22:             int temp = Convert.ToInt32(com.ExecuteScalar().ToString());
    Line 23:             conn.Close();
    Line 24:             if (temp == 1)

    Source File: c:\Users\bastin\Documents\Visual Studio 2012\WebSites\WebSite7\login.aspx.cs    Line: 22 

    Stack Trace: 
    [SqlException (0x80131904): Incorrect syntax near the keyword 'Table'.]
       System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) +1767866
       System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) +5352418
       System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) +244
       System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) +1691
       System.Data.SqlClient.SqlDataReader.TryConsumeMetaData() +61
       System.Data.SqlClient.SqlDataReader.get_MetaData() +90
       System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +365
       System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, SqlDataReader ds) +1406
       System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean asyncWrite) +177
       System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) +53
       System.Data.SqlClient.SqlCommand.ExecuteScalar() +149
       login.Button_Login_Click(Object sender, EventArgs e) in c:\Users\bastin\Documents\Visual Studio 2012\WebSites\WebSite7\login.aspx.cs:22
       System.Web.UI.WebControls.Button.OnClick(EventArgs e) +9752490
       System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +196
       System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
       System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
       System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +35
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1724
    


    Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.18447

                

    Tuesday, June 24, 2014 10:03 PM

Answers

  • Hello,

    From the error message, it already shows the reason: The “Table” is keyword in SQLSever which cannot be queried directly as:

    select count(*) from Table

    Please add “[]“ around keywords as:

    select count(*) from [Table]

    If this does not work for you, please let me know.

    Regards.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, June 25, 2014 9:03 AM
    Moderator

All replies

  • My program is:

                            

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Data.SqlClient;
    using System.Configuration;

    public partial class RegistrationModule : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack)
            {
                SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["RegistrationConnectionString"].ConnectionString);
                conn.Open();
                string checkuser = "select count(*) from Table where User_Name='" + TextBox1.Text + "'";
                SqlCommand com = new SqlCommand(checkuser, conn);
                int temp = Convert.ToInt32(com.ExecuteScalar().ToString());
                conn.Close();
                if (temp == 1)
                {
                    Response.Write("User already Exists");
                }

            }
        }
        protected void Button1_Click(object sender, EventArgs e)
        {
            try
            {
                Guid newGuid = Guid.NewGuid();
                SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["RegistrationConnectionString"].ConnectionString);
                conn.Open();
                string insertQuery = "insert into Table(ID,User Name,Email,Password,Security Question,Security Answer) Values(@ID,@Uname,@email,@password,@security Question,@Security Answer)";
                string checkuser = "select count(*) from UserData where User_Name='" + TextBox1.Text + "'";
                SqlCommand com = new SqlCommand(insertQuery, conn);
                com.Parameters.AddWithValue("@ID",newGuid.ToString());
                com.Parameters.AddWithValue("@Uname", TextBox1.Text);
                com.Parameters.AddWithValue("@email", TextBox2.Text);
                com.Parameters.AddWithValue("@password", TextBox3.Text);
                com.Parameters.AddWithValue("@security Question", TextBox4.Text);
                com.Parameters.AddWithValue("@Security Answer", TextBox5.Text);
                com.ExecuteNonQuery();

                Response.Write("Registration is Sucessful");
                conn.Close();
            }
            catch (Exception ex)
            {
                Response.Write("Error:" + ex.ToString());

            }
        }
    }

    When I Run this program, Im getting the Registration page to enter username, Password,Confirm Password and the remaining fields, but, when i enter all the fields and give submit, im Getting the below Error                                                 

    Server Error in '/' Application.

    Incorrect syntax near the keyword 'Table'.

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

    Exception Details: System.Data.SqlClient.SqlException: Incorrect syntax near the keyword 'Table'.

    Source Error: 
    Line 18:             string checkuser = "select count(*) from Table where User_Name='" + TextBox1.Text + "'";
    Line 19:             SqlCommand com = new SqlCommand(checkuser, conn);
    Line 20:             int temp = Convert.ToInt32(com.ExecuteScalar().ToString());
    Line 21:             conn.Close();
    Line 22:             if (temp == 1)

    Source File: c:\Users\bastin\Documents\Visual Studio 2012\WebSites\WebSite7\RegistrationModule.aspx.cs    Line: 20 

    Stack Trace: 
    [SqlException (0x80131904): Incorrect syntax near the keyword 'Table'.]
       System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) +1767866
       System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) +5352418
       System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) +244
       System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) +1691
       System.Data.SqlClient.SqlDataReader.TryConsumeMetaData() +61
       System.Data.SqlClient.SqlDataReader.get_MetaData() +90
       System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +365
       System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, SqlDataReader ds) +1406
       System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean asyncWrite) +177
       System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) +53
       System.Data.SqlClient.SqlCommand.ExecuteScalar() +149
       RegistrationModule.Page_Load(Object sender, EventArgs e) in c:\Users\bastin\Documents\Visual Studio 2012\WebSites\WebSite7\RegistrationModule.aspx.cs:20
       System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +51
       System.Web.UI.Control.OnLoad(EventArgs e) +92
       System.Web.UI.Control.LoadRecursive() +54
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +772
    


    Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.18447                                                         Any one, Pls Help Me

    Tuesday, June 24, 2014 10:11 PM
  • My Program Is:

                

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Data.SqlClient;
    using System.Configuration;

    public partial class login : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }
        protected void Button_Login_Click(object sender, EventArgs e)
        {
            SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["RegistrationConnectionString"].ConnectionString);
                conn.Open();
                string checkuser = "select count(*) from Table where User_Name='" + TextBoxUserName.Text + "'";
                SqlCommand com = new SqlCommand(checkuser, conn);
                int temp = Convert.ToInt32(com.ExecuteScalar().ToString());
                conn.Close();
                if (temp == 1)
                {
                    conn.Open();
                    string checkPasswordQuery = "select password from Table where User_Name='" + TextBoxUserName.Text + "'";
                    SqlCommand passcom = new SqlCommand(checkPasswordQuery, conn);
                    string password = passcom.ExecuteScalar().ToString();
                    if (password == TextBoxPassword.Text)
                    {
                        Session["New"] = TextBoxUserName.Text;
                        Response.Write("Password is correct");
                    }
                    else
                    {
                        Response.Write("Password is not correct");
                    }
                }
                else
                {
                    Response.Write("UserName is not correct");



                }

        }
    }

    When i Run this, Im Getting the Login Page to enter User Name and Password and when i fill all the fields and click on the submit button, it shows the error Below, Kindly any one help me

    Server Error in '/' Application.

    Incorrect syntax near the keyword 'Table'.

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

    Exception Details: System.Data.SqlClient.SqlException: Incorrect syntax near the keyword 'Table'.

    Source Error: 
    Line 20:             string checkuser = "select count(*) from Table where User_Name='" + TextBoxUserName.Text + "'";
    Line 21:             SqlCommand com = new SqlCommand(checkuser, conn);
    Line 22:             int temp = Convert.ToInt32(com.ExecuteScalar().ToString());
    Line 23:             conn.Close();
    Line 24:             if (temp == 1)

    Source File: c:\Users\bastin\Documents\Visual Studio 2012\WebSites\WebSite7\login.aspx.cs    Line: 22 

    Stack Trace: 
    [SqlException (0x80131904): Incorrect syntax near the keyword 'Table'.]
       System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) +1767866
       System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) +5352418
       System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) +244
       System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) +1691
       System.Data.SqlClient.SqlDataReader.TryConsumeMetaData() +61
       System.Data.SqlClient.SqlDataReader.get_MetaData() +90
       System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +365
       System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, SqlDataReader ds) +1406
       System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean asyncWrite) +177
       System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) +53
       System.Data.SqlClient.SqlCommand.ExecuteScalar() +149
       login.Button_Login_Click(Object sender, EventArgs e) in c:\Users\bastin\Documents\Visual Studio 2012\WebSites\WebSite7\login.aspx.cs:22
       System.Web.UI.WebControls.Button.OnClick(EventArgs e) +9752490
       System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +196
       System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
       System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
       System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +35
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1724
    


    Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.18447


    Tuesday, June 24, 2014 10:15 PM
  • Hello,

    From the error message, it already shows the reason: The “Table” is keyword in SQLSever which cannot be queried directly as:

    select count(*) from Table

    Please add “[]“ around keywords as:

    select count(*) from [Table]

    If this does not work for you, please let me know.

    Regards.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, June 25, 2014 9:03 AM
    Moderator
  • Thanks for your help,but i tried with the above solution,but still ,im getting below error and i used bracket for user_Name. but still, it shows the same error

    Server Error in '/' Application.

    Invalid column name 'User_Name'.

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

    Exception Details: System.Data.SqlClient.SqlException: Invalid column name 'User_Name'.

    Source Error: 
    Line 20:             string checkuser = "select count(*) from [Table] where User_Name='" + TextBoxUserName.Text + "'";
    Line 21:             SqlCommand com = new SqlCommand(checkuser, conn);
    Line 22:             int temp = Convert.ToInt32(com.ExecuteScalar().ToString());
    Line 23:             conn.Close();
    Line 24:             if (temp == 1)

    Source File: c:\Users\bastin\Documents\Visual Studio 2012\WebSites\WebSite7\login.aspx.cs    Line: 22 

    Stack Trace: 
    [SqlException (0x80131904): Invalid column name 'User_Name'.]
       System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) +1767866
       System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) +5352418
       System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) +244
       System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) +1691
       System.Data.SqlClient.SqlDataReader.TryConsumeMetaData() +61
       System.Data.SqlClient.SqlDataReader.get_MetaData() +90
       System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +365
       System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, SqlDataReader ds) +1406
       System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean asyncWrite) +177
       System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) +53
       System.Data.SqlClient.SqlCommand.ExecuteScalar() +149
       login.Button_Login_Click(Object sender, EventArgs e) in c:\Users\bastin\Documents\Visual Studio 2012\WebSites\WebSite7\login.aspx.cs:22
       System.Web.UI.WebControls.Button.OnClick(EventArgs e) +9752490
       System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +196
       System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
       System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
       System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +35
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1724
    


    Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.18447


    Wednesday, June 25, 2014 11:19 PM
  • hanks for your help,but i tried with the above solution,but still ,im getting below error and i used bracket for user_Name. but still, it shows the same error

    Server Error in '/' Application.

    Invalid column name 'User_Name'.

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

    Exception Details: System.Data.SqlClient.SqlException: Invalid column name 'User_Name'.

    Source Error: 
    Line 20:             string checkuser = "select count(*) from [Table] where User_Name='" + TextBoxUserName.Text + "'";
    Line 21:             SqlCommand com = new SqlCommand(checkuser, conn);
    Line 22:             int temp = Convert.ToInt32(com.ExecuteScalar().ToString());
    Line 23:             conn.Close();
    Line 24:             if (temp == 1)

    Source File: c:\Users\bastin\Documents\Visual Studio 2012\WebSites\WebSite7\login.aspx.cs    Line: 22 

    Stack Trace: 
    [SqlException (0x80131904): Invalid column name 'User_Name'.]
       System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) +1767866
       System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) +5352418
       System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) +244
       System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) +1691
       System.Data.SqlClient.SqlDataReader.TryConsumeMetaData() +61
       System.Data.SqlClient.SqlDataReader.get_MetaData() +90
       System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +365
       System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, SqlDataReader ds) +1406
       System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean asyncWrite) +177
       System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) +53
       System.Data.SqlClient.SqlCommand.ExecuteScalar() +149
       login.Button_Login_Click(Object sender, EventArgs e) in c:\Users\bastin\Documents\Visual Studio 2012\WebSites\WebSite7\login.aspx.cs:22
       System.Web.UI.WebControls.Button.OnClick(EventArgs e) +9752490
       System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +196
       System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
       System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
       System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +35
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1724
    


    Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.18447


    Wednesday, June 25, 2014 11:20 PM
  • Hello,

    >> Thanks for your help,but i tried with the above solution,but still ,im getting below error and i used bracket for user_Name. but still, it shows the same error

    From the message, it is another one not the same with your first issue.

    For this sql statement “select count(*) from [Table] where User_Name='" + TextBoxUserName.Text + "'”, do you have a try to execute it in your sqlsever management studio directly? If it also throws this error, then I really wonder if there is a column named “User_Name” in your table.

    Please share your table with us and which sqlsever you are working with.

    And please have a try to change it to “username” without the “_” symbol to check whether it could work fine because if your sqlserver is 2005+, there is a function named “User_Name”, I am not sure whether they are conflict, however, it is recommended to avoid naming columns name the same with functions.

    Regards.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, June 26, 2014 8:19 AM
    Moderator