database access problem

S

soljshavitz

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>
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top