Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6881361
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T05:05:52+00:00 2026-05-27T05:05:52+00:00

I have a form that after the user inputs a user name and password

  • 0

I have a form that after the user inputs a user name and password and click the add button it should add it to my tblUserLogin. Right now it has an error that says:

Format of the initialization string does not conform to specification
starting at index 0. 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.ArgumentException: Format of the
initialization string does not conform to specification starting at
index 0.

Line 40:            // userPassword = (txtPassword.Text);
Line 41: 
Line 42:         using (OleDbConnection conn = new OleDbConnection("PayrollSystem_DBConnectionString"))
Line 43: 
Line 44:          {

Here is the html code for my frmManageUsers form:

<asp:SqlDataSource ID="SqlDataSource1" runat="server"  
        ConnectionString="<%$ ConnectionStrings:PayrollSystem_DBConnectionString %>"  
        ProviderName="<%$ ConnectionStrings:PayrollSystem_DBConnectionString.ProviderName %>"  

   SelectCommand="SELECT [UserID], [UserName], [UserPassword], [SecurityLevel] FROM [tblUserLogin]"> 
</asp:SqlDataSource> 

</div> 
    <div align="center"> 
    <asp:Label ID="Label1" runat="server" Text="Manage Users"></asp:Label> 
<p> 
    <asp:Label ID="Label2" runat="server" Text="User Name:"></asp:Label> 
    <asp:TextBox ID="txtUserName" runat="server"></asp:TextBox> 
</p> 
<p> 
    <asp:Label ID="Label3" runat="server" Text="Password:"></asp:Label> 
    <asp:TextBox ID="txtPassword" runat="server"></asp:TextBox> 
</p> 
        <p> 
            <asp:Label ID="Label4" runat="server" Text="Security Level:"></asp:Label> 
            <asp:DropDownList ID="drpdwnlstSecurityLevel" runat="server"  
                onselectedindexchanged="drpdwnlstSecurityLevel_SelectedIndexChanged"> 
                <asp:ListItem>A</asp:ListItem> 
                <asp:ListItem>U</asp:ListItem> 
            </asp:DropDownList> 
</p> 
        <p> 
            <asp:Button ID="btnAddUser" runat="server" onclick="btnAddUser_Click1"  
    Text="Add User" />  
  </p> 
        <p> 
            <asp:Label ID="lblError" runat="server"></asp:Label> 
</p> 

    </div> 
<p> 
    &nbsp;</p> 
            <div align="center"> 
<asp:GridView ID="tblUserLogin" runat="server" AutoGenerateColumns="False"  
    DataSourceID="SqlDataSource1"> 
    <Columns> 
        <asp:BoundField DataField="UserID" HeaderText="UserID" InsertVisible="False"  
            SortExpression="UserID"></asp:BoundField> 
        <asp:BoundField DataField="UserName" HeaderText="UserName"  
            SortExpression="UserName"></asp:BoundField> 
        <asp:BoundField DataField="UserPassword" HeaderText="UserPassword"  
            SortExpression="UserPassword"></asp:BoundField> 
        <asp:BoundField DataField="SecurityLevel" HeaderText="SecurityLevel"  
            SortExpression="SecurityLevel"></asp:BoundField> 
        <asp:CommandField ShowEditButton="True"></asp:CommandField> 
        <asp:CommandField ShowDeleteButton="True"></asp:CommandField> 
    </Columns> 
</asp:GridView> 
</form> 
</body> 
</html>

Here’s my code:

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

    protected void btnAddUser_Click1(object sender, EventArgs e) 
    { 
        //string userName, userPassword; 

        if (txtUserName.Text == "" || txtUserName.Text == null) 
        { 
            lblError.Text = ("User Name may not be empty"); 
            lblError.ForeColor = System.Drawing.Color.Red; 
            return; 
        } 

        if (txtPassword.Text == "" || txtPassword.Text == null) 
        { 
            lblError.Text = ("Password may not be empty"); 
            lblError.ForeColor = System.Drawing.Color.Red; 
            return; 
        } 

        using (OleDbConnection conn = new OleDbConnection("PayrollSystem_DBConnectionString")) 
        { 
            string insert = "Insert INTO tblUserLogin (UserName, UserPassword, SecurityLevel) Values (@UserName, @UserPassword, @SecurityLevel)"; 
            OleDbCommand cmd = new OleDbCommand(insert, conn); 
            cmd.Parameters.Add("@UserName", txtUserName.Text); 
            cmd.Parameters.Add("@UserPassword", txtPassword.Text); 
            cmd.Parameters.Add("@SecurityLevel", drpdwnlstSecurityLevel.SelectedValue);   
            cmd.ExecuteNonQuery();       
        } 

        Session["UserName"] = txtUserName.Text; 
        Session["Password"] = txtPassword.Text; 
        Session["SecurityLevel"] = drpdwnlstSecurityLevel.SelectedValue; 
        Server.Transfer("frmManageUsers.aspx"); 

        //Server.Transfer("grdUserLogin");  
    } 
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T05:05:52+00:00Added an answer on May 27, 2026 at 5:05 am

    You actually need to pass the valid Connection String to the connection constructor:

    OleDbConnection conn = new OleDbConnection("PayrollSystem_DBConnectionString")
    // this is not an actual connection string
    

    Check out Connection Strings to assist in making your valid connection string.

    What it does look like though is that you’re trying to pull your connection string out of your web.config file. Something like this would work:

    using System.Configuration;
    
    // ....
    
    OleDbConnection conn = 
        new OleDbConnection(ConfigurationManager.ConnectionStrings["PayrollSystem_DBConnectionString"].ConnectionString);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a form that and after the user fills in this form, I
I have a form in an HTM page that, after pressing the submit button,
I have a form that allows the user to add as many upload forms
I have a form inside a dialog that appears after clicking in another button.
I have a form that is closed unexpectedly immediately after showing it. I hooked
I currently have form that checks if a user has unsubmitted changes when they
I have product name(in paragraph), text form and button. The products have id's as
I have a form on a page where the user has inputs to edit
I have an RMA form that I've been able to add fields dynamically, but
I have the page below, everything works fine... Except that after I click the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.