I'm trying to insert into an Access database using an ASPX web page but I'm
not finding a lot of info in my ASP.NET book or online on how to do this.
I have a web page setup with text boxes for the user to fill-in data. When
the user clicks a Save button, the code behind should first check to make
sure a duplicate name doesn't already exist (the name is not the primary key
in the table). If that passes, then it should insert it into the table. There is
plenty of documentation on how to do this with a SQL data source, but not
an AccessDataSource in VisStudio2005. If there is, I'm not finding it.
This is the asp code for the AccessDataSource insertcommand:
<asp:AccessDataSource ID="karatedb" runat="server" DataFile="~/App_Data/karate.mdb"
InsertCommand="INSERT INTO [Members]([Last_Name], [First_Name], [Phone])
VALUES (@txtLast_Name, @txtFirst_Name, @txtPhone)">
</asp:AccessDataSource>
I don't know what syntax I have to use in my code behind file to get the
insert to work.
Any ideas?
Thanks, Paul
not finding a lot of info in my ASP.NET book or online on how to do this.
I have a web page setup with text boxes for the user to fill-in data. When
the user clicks a Save button, the code behind should first check to make
sure a duplicate name doesn't already exist (the name is not the primary key
in the table). If that passes, then it should insert it into the table. There is
plenty of documentation on how to do this with a SQL data source, but not
an AccessDataSource in VisStudio2005. If there is, I'm not finding it.
This is the asp code for the AccessDataSource insertcommand:
<asp:AccessDataSource ID="karatedb" runat="server" DataFile="~/App_Data/karate.mdb"
InsertCommand="INSERT INTO [Members]([Last_Name], [First_Name], [Phone])
VALUES (@txtLast_Name, @txtFirst_Name, @txtPhone)">
</asp:AccessDataSource>
I don't know what syntax I have to use in my code behind file to get the
insert to work.
Any ideas?
Thanks, Paul
