locked
Cant Submit record to Database => No error message available, result code: DB_SEC_E_AUTH_FAILED(0x80040E4D). RRS feed

  • Question

  • User-1325030707 posted

    Hi, I doing a simple form to try inserting record into an Access database but keep getting error. Need some help on this error.

    Here is my coding... Thanks

    <%@ Page Language="vb" AutoEventWireup="false" CodeBehind="UserDetails.aspx.vb" Inherits="UserDetails.UserDetails" %>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>User Details Form</title>
    </head>
    <body>
        <form id="form1" runat="server">
            <table>
                <tr>
                    <td style="text-align:left">Name:</td>
                    <td><asp:TextBox ID="Name" Width="200px" runat="server" /></td>
                    <td><asp:RequiredFieldValidator ControlToValidate="Name" ID="nametext" Display="Static" EnableClientScript="false" runat="server">
                    Please Enter a first name.</asp:RequiredFieldValidator></td>
                </tr> 
                <tr>
                    <td style="text-align:left">Sex:</td>
                    <td><asp:TextBox ID="Sex" Width="200px" runat="server" /></td>
                    <td><asp:RequiredFieldValidator ControlToValidate="Sex" ID="sextext" Display="Static" EnableClientScript="false" runat="server">
                    Please Enter Your Sex.</asp:RequiredFieldValidator></td>
                </tr> 
                <tr>
                    <td style="text-align:left">Marital Status:</td>
                    <td><asp:TextBox ID="MaritalStatus" Width="200px" runat="server" /></td>
                    <td><asp:RequiredFieldValidator ControlToValidate="MaritalStatus" ID="maritalStattext" Display="Static" EnableClientScript="false" runat="server">
                    Please Enter Your Marital Status</asp:RequiredFieldValidator></td>
                </tr>
                <tr>
                    <td style="text-align:left">Date:</td>
                    <td><asp:TextBox ID="Date" Width="200px" runat="server" /></td>
                    <td><asp:RangeValidator ControlToValidate="Date" ID="datetext" Type="Date" minimumvalue="01-01-2011" maximumvalue="01-12-2011" errormessage="Please enter a valid date within 2011!" Display="Static" EnableClientScript="false" runat="server" /></td>
                </tr>
                <tr>
                    <td><asp:Button ID="Button1" Text="Submit" runat="server" /></td>
                </tr> 
            </table>
            <asp:AccessDataSource ID="ManageDataSource" runat="server"
            InsertCommand="INSERT INTO [User Details] ([Name],[Sex],[MaritalStatus], [Date])
            VALUES (?,?,?,?)"
            UpdateCommand="UPDATE [User Details] SET [Name] = ?, [Sex] = ?, [MaritalStatus] = ?, [Date] = ?">
            <UpdateParameters>
                <asp:Parameter Name="Name" Type="String" />
                <asp:Parameter Name="Sex" Type="String" />
                <asp:Parameter Name="MaritalStatus" Type="String" />
                <asp:Parameter Name="Date" Type="DateTime" />
            </UpdateParameters>
            <InsertParameters>
                <asp:Parameter Name="Name" Type="String" />
                <asp:Parameter Name="Sex" Type="String" />
                <asp:Parameter Name="MaritalStatus" Type="String" />
                <asp:Parameter Name="Date" Type="DateTime" />
            </InsertParameters>
            </asp:AccessDataSource>
        </form>
    </body>
    </html>
    
    Monday, July 4, 2011 6:24 AM

Answers

  • User-1199946673 posted

    You didn't specify the DataFile property of the AccessDataSource. Also, you didn't specify a SelectCommand. And in the Update command, there's no WHERE clause, which will cause all records in the table to be updated....

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, July 4, 2011 8:09 AM

All replies

  • User-269404413 posted

    Cwwaicw,

    i doubt on some thing problem with the connection string

    Provider=Microsoft.Jet.OLEDB.4.0;Data Source="C:\inetpub\NameOfApp\dbname.mdb"

    for more information refer this aricle http://osherove.com/blog/2003/4/3/avoiding-db_sec_e_auth_failed-exception-on-connection-string.html

     

    Monday, July 4, 2011 6:47 AM
  • User-1199946673 posted

    You didn't specify the DataFile property of the AccessDataSource. Also, you didn't specify a SelectCommand. And in the Update command, there's no WHERE clause, which will cause all records in the table to be updated....

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, July 4, 2011 8:09 AM
  • User3866881 posted

    Hello cwwaicw311:)

    Your AccessDataSource isn't complete, and it's wrong. You are lacking of DataFile property, which points to what db will be dealt with.

    So please do what hans_v's said.'

    And here's my addition——

    Call like this——

    ManageDataSource.InsertParameters[0].DefaultValue = xxx;

    ………………

    ManageDataSource.InsertParameters[N].DefaultValue = xxx;

    ManageDataSource.Insert();

    PS:Next time would you mind telling us what mistake (wrong) is thrown out? What err msg  u have got?

    Thx

    Tuesday, July 5, 2011 10:05 PM