database access problem

Discussion in 'ASP .Net' started by soljshavitz@yahoo.com, Aug 20, 2007.

  1. Guest

    I have a database (access2003) that i dragged into my App_data folder
    on my webprovider's server that I use with .NET 2003. I looked at the
    properties and it still says my path is C:\.....mdb. Is this expected?
    The reason I ask is I have some code to add a record and it's has no
    errors but will not write to the DB. I checked the security on my
    Host's server and that is OK. The page looks fine in the browser. I
    have a DetailsView1 on the page with the option set to allow inserts.
    I tried editing my Webconfig to the complete URL of my website's
    App_Data and that didn't work either. Here's my code:

    <%@ Page Explicit="True" Language="VB" Debug="True" %>
    <%@ Import Namespace="System.Data" %>
    <%@ Import Namespace="System.Data.OleDb" %>
    <html>
    <body vlink="red">
    <h1>Barcoded Products</h1>

    <form id="Form1" runat="server">

    <h2>Enter New Product</h2>

    <script runat="server">
    Protected Sub Page_Load(ByVal sender As Object, _
    ByVal e As System.EventArgs)

    DetailsView1.ChangeMode(DetailsViewMode.Insert)
    End Sub

    Protected Sub DetailsView1_ItemInserted( _
    ByVal sender As Object, ByVal e As _
    System.Web.UI.WebControls.DetailsViewInsertedEventArgs)

    Response.Redirect("default.aspx")
    End Sub

    Protected Sub DetailsView1_ItemCommand( _
    ByVal sender As Object, ByVal e As _
    System.Web.UI.WebControls.DetailsViewCommandEventArgs)

    If e.CommandName = "Cancel" Then
    Response.Redirect("default.aspx")
    End If
    End Sub

    </script>

    <br />

    <asp:DetailsView ID="DetailsView1" runat="server"
    Height="50px" Width="100%" AutoGenerateRows="False"
    DataKeyNames="ProdNum" DataSourceID="SqlDataSource1"
    CellPadding="4" ForeColor="#333333" GridLines="None"
    OnItemInserted="DetailsView1_ItemInserted"
    OnItemCommand="DetailsView1_ItemCommand">

    <Fields>
    <asp:BoundField DataField="Title" HeaderText="Product"
    SortExpression="Product" />
    </Fields>

    <RowStyle BackColor="#FFFBD6" ForeColor="#333333" />

    <FieldHeaderStyle BackColor="#FFFF99" Font-Bold="True" />

    </asp:DetailsView>

    &nbsp;

    <asp:SqlDataSource ID="SqlDataSource1" runat="server"
    ConflictDetection="CompareAllValues"
    ConnectionString=
    "<%$ ConnectionStrings:BarCodedProductConnectString %>"
    InsertCommand="INSERT INTO Ads (Product) VALUES (?)"
    ProviderName=
    "<%$ ConnectionStrings:BarCodedProductConnectString.ProviderName %>"
    SelectCommand="SELECT Product FROM Ads" >

    <InsertParameters>
    <asp:parameter Name="Title" Type="String" />

    </InsertParameters>
    </asp:SqlDataSource>

    </form>
    </body>
    </html>
     
    , Aug 20, 2007
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. MSDN
    Replies:
    0
    Views:
    683
  2. Fernando Lopes
    Replies:
    0
    Views:
    864
    Fernando Lopes
    Mar 29, 2005
  3. JC
    Replies:
    3
    Views:
    590
    =?ISO-8859-2?Q?Dra=BEen_Gemi=E6?=
    Jun 19, 2006
  4. Sree
    Replies:
    8
    Views:
    310
    Netocrat
    Dec 19, 2005
  5. Tony Johansson
    Replies:
    7
    Views:
    512
    Gregory A. Beamer
    Dec 23, 2009
Loading...

Share This Page