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 />
<aspetailsView 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" />
</aspetailsView>
<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>
<asparameter Name="Title" Type="String" />
</InsertParameters>
</asp:SqlDataSource>
</form>
</body>
</html>
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 />
<aspetailsView 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" />
</aspetailsView>
<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>
<asparameter Name="Title" Type="String" />
</InsertParameters>
</asp:SqlDataSource>
</form>
</body>
</html>