hey guys,
I'm having some difficulty getting the following to work properly. I'm trying to insert records into a database using the below below but I keep getting the error: "Syntax error in INSERT INTO statement." Why I really don't know.
your help would be greatly appreciated
I copied everything so u can get an idea of what i'm doing.
I'm inserting the records into a Microsoft access database file named ModDb more specifically into a table named record
here's the code
I'm having some difficulty getting the following to work properly. I'm trying to insert records into a database using the below below but I keep getting the error: "Syntax error in INSERT INTO statement." Why I really don't know.
your help would be greatly appreciated
I copied everything so u can get an idea of what i'm doing.
I'm inserting the records into a Microsoft access database file named ModDb more specifically into a table named record
here's the code
Code:
<%@ Page Language="VB" Debug="true"%>
<%@ Import Namespace=system.data.oledb %>
<script runat=server >
</script>
<html>
<head runat="server">
<title>Modular Database</title>
</head>
<body >
<form runat="server">
<asp:AccessDataSource runat="server" ID="ADS" DataFile="ModDB.mdb"
Selectcommand="SELECT * FROM Record"
InsertCommand="INSERT INTO Record (Fname, Lname, Module, Age, Sex) VALUES
(@Fname, @Lname, @Module, @Age, @Sex)"
>
</asp:AccessDataSource>
<asp:FormView runat="server" DataSourceID="ADS" ID="FV" DefaultMode="Insert" >
<InsertItemTemplate>
<table>
<tr>
<td>First Name:</td>
<td><asp:TextBox runat="server" ID="txtfname" Text='<%# bind("Fname") %>' /></td>
</tr>
<tr>
<td>Last Name:</td>
<td><asp:TextBox runat="server" ID="txtlname" Text='<%# bind("Lname") %>'/></td>
</tr>
<tr>
<td>Module</td>
<td><asp:TextBox runat="server" ID="txtmodule" Text='<%# bind("Module") %>' /></td>
</tr>
<tr>
<td>Age</td>
<td><asp:TextBox runat="server" ID="txtage" Text='<%# bind("Age") %>' /></td>
</tr>
<tr>
<td>Sex</td>
<td><asp:TextBox runat="server" ID="txtsex" Text='<%# bind("Sex") %>' /></td>
</tr>
<tr>
<td><asp:Button runat="server" Text="submit" CommandName="Insert" /> </td>
</tr>
</table>
</InsertItemTemplate>
</asp:FormView>
</form>
</body>
</html>