Tech Off Thread

3 posts

Forum Read Only

This forum has been made read only by the site admins. No new threads or comments can be added.

register a new user

Back to Forum: Tech Off
  • User profile image
    Rake

    i get this error

    Compilation Error

    Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

    Compiler Error Message: CS1002: ; expected

    Source Error:

    Line 13:     }
    Line 14:             else {
    Line 15:                 Msg.Text = "Invalid Credentials: Please try again or " + _ "<a ref='newuser.aspx'>register a new user</a>";
    Line 16:             }
    Line 17:   


    here's the code

    <script runat="server">

        void LoginBtn_Click(Object sender, EventArgs e) {
       
            if (Page.IsValid) {
                System.Data.DataSet userDS = new System.Data.DataSet();
        userDS = GetUser(UserName.Text, UserPass.Text);
       
        if (userDS.Tables[0].Rows.Count == 1) {
            Session["userid"] = userDS.Tables[0].Rows[0].ItemArray[0];
            FormsAuthentication.RedirectFromLoginPage(UserName.Text, false);
        }
                else {
                    Msg.Text = "Invalid Credentials: Please try again or " + _ "<a ref='newuser.aspx'>register a new user</a>";
                }
            }
        }
            System.Data.DataSet GetUser(string username, string password) {
                string connectionString = "Provider=Microsoft.Jet.OLEDB.4.0; Ole DB Services=-4; Data Source=r:\\nome" +
        "d\\got\\you.mdb";
                System.Data.IDbConnection dbConnection = new System.Data.OleDb.OleDbConnection(connectionString);
       
                string queryString = "SELECT [members].* FROM [members] WHERE (([members].[username] = @username) AND (" +
        "[members].[password] = @password))";
                System.Data.IDbCommand dbCommand = new System.Data.OleDb.OleDbCommand();
                dbCommand.CommandText = queryString;
                dbCommand.Connection = dbConnection;
       
                System.Data.IDataParameter dbParam_username = new System.Data.OleDb.OleDbParameter();
                dbParam_username.ParameterName = "@username";
                dbParam_username.Value = username;
                dbParam_username.DbType = System.Data.DbType.String;
                dbCommand.Parameters.Add(dbParam_username);
                System.Data.IDataParameter dbParam_password = new System.Data.OleDb.OleDbParameter();
                dbParam_password.ParameterName = "@password";
                dbParam_password.Value = password;
                dbParam_password.DbType = System.Data.DbType.String;
                dbCommand.Parameters.Add(dbParam_password);
       
                System.Data.IDbDataAdapter dataAdapter = new System.Data.OleDb.OleDbDataAdapter();
                dataAdapter.SelectCommand = dbCommand;
                System.Data.DataSet dataSet = new System.Data.DataSet();
                dataAdapter.Fill(dataSet);
       
                return dataSet;
            }

    How can i make this work?

  • User profile image
    Rake

    never mind got it


    Msg.Text = "Invalid Credentials: Please try again or <a href='NewUser.aspx'>register a new user</a>"

  • User profile image
    ZippyV

    The problem was with the _ character.

Conversation locked

This conversation has been locked by the site admins. No new comments can be made.