I use a dataset (TableAdapter Prepress_Request_Form) connected to a MSDE Server and with a SQLOLEDB connection.
The PrimaryKey is PrepressID and my Methods of my dataset are the followings:
1)GetPre()
SELECT Prepress_Request_Form.*
FROM Prepress_Request_Form
2)DeletePre()
DELETE FROM [Prepress_Request_Form] WHERE (([PrepressID] = ?))
3) InsertPre()
INSERT INTO [Prepress_Request_Form] ([Comp], [Job_Number], [Request_Date], [Customer], [Contact_Name], [Tel], [email], [Media], [Job_Size], [Colors], [Number_of_Lots], [Proof], [Job_Detail]) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
4)UpdatePre()
UPDATE [Prepress_Request_Form] SET [Comp] = ?, [Job_Number] = ?, [Request_Date] = ?, [Customer] = ?, [Contact_Name] = ?, [Tel] = ?, [email] = ?, [Media] = ?, [Job_Size] = ?, [Colors] = ?, [Number_of_Lots] = ?, [Proof] = ?, [Job_Detail] = ? WHERE (([PrepressID] = ?))
Here is my code:
Expand|Select|Wrap|Line Numbers
- <%@ Page Language="VB" AutoEventWireup="false" CodeFile="Edit.aspx.vb" Inherits="Edit" %>
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml" >
- <head runat="server">
- <title>Untitled Page</title>
- </head>
- <body>
- <form id="form1" runat="server">
- <div>
- <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" DeleteMethod="DeletePre"
- InsertMethod="InsertPre" OldValuesParameterFormatString="{0}" SelectMethod="GetPre"
- TypeName="TestTableAdapters.Prepress_Request_FormTableAdapter" UpdateMethod="UpdatePre">
- <DeleteParameters>
- <asp:Parameter Name="PrepressID" Type="Int32" />
- </DeleteParameters>
- <UpdateParameters>
- <asp:Parameter Name="Comp" Type="Int32" />
- <asp:Parameter Name="Job_Number" Type="Int32" />
- <asp:Parameter Name="Request_Date" Type="DateTime" />
- <asp:Parameter Name="Customer" Type="String" />
- <asp:Parameter Name="Contact_Name" Type="String" />
- <asp:Parameter Name="Tel" Type="String" />
- <asp:Parameter Name="Email" Type="String" />
- <asp:Parameter Name="Media" Type="String" />
- <asp:Parameter Name="Job_Size" Type="String" />
- <asp:Parameter Name="Colors" Type="String" />
- <asp:Parameter Name="Number_of_Lots" Type="String" />
- <asp:Parameter Name="Proof" Type="String" />
- <asp:Parameter Name="Job_Detail" Type="String" />
- <asp:Parameter Name="PrepressID" Type="Int32" />
- </UpdateParameters>
- <InsertParameters>
- <asp:Parameter Name="Comp" Type="Int32" />
- <asp:Parameter Name="Job_Number" Type="Int32" />
- <asp:Parameter Name="Request_Date" Type="DateTime" />
- <asp:Parameter Name="Customer" Type="String" />
- <asp:Parameter Name="Contact_Name" Type="String" />
- <asp:Parameter Name="Tel" Type="String" />
- <asp:Parameter Name="Email" Type="String" />
- <asp:Parameter Name="Media" Type="String" />
- <asp:Parameter Name="Job_Size" Type="String" />
- <asp:Parameter Name="Colors" Type="String" />
- <asp:Parameter Name="Number_of_Lots" Type="String" />
- <asp:Parameter Name="Proof" Type="String" />
- <asp:Parameter Name="Job_Detail" Type="String" />
- </InsertParameters>
- </asp:ObjectDataSource>
- </div>
- <asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" DataKeyNames="PrepressID"
- DataSourceID="ObjectDataSource1" DefaultMode="Insert" Height="50px" Width="125px">
- <Fields>
- <asp:BoundField DataField="PrepressID" HeaderText="PrepressID" InsertVisible="False"
- ReadOnly="True" SortExpression="PrepressID" />
- <asp:BoundField DataField="Comp" HeaderText="Comp" SortExpression="Comp" />
- <asp:BoundField DataField="Job_Number" HeaderText="Job_Number" SortExpression="Job_Number" />
- <asp:BoundField DataField="Request_Date" HeaderText="Request_Date" SortExpression="Request_Date" />
- <asp:BoundField DataField="Customer" HeaderText="Customer" SortExpression="Customer" />
- <asp:BoundField DataField="Contact_Name" HeaderText="Contact_Name" SortExpression="Contact_Name" />
- <asp:BoundField DataField="Tel" HeaderText="Tel" SortExpression="Tel" />
- <asp:BoundField DataField="Email" HeaderText="Email" SortExpression="Email" />
- <asp:BoundField DataField="Media" HeaderText="Media" SortExpression="Media" />
- <asp:BoundField DataField="Job_Size" HeaderText="Job_Size" SortExpression="Job_Size" />
- <asp:BoundField DataField="Colors" HeaderText="Colors" SortExpression="Colors" />
- <asp:BoundField DataField="Number_of_Lots" HeaderText="Number_of_Lots" SortExpression="Number_of_Lots" />
- <asp:BoundField DataField="Proof" HeaderText="Proof" SortExpression="Proof" />
- <asp:BoundField DataField="Job_Detail" HeaderText="Job_Detail" SortExpression="Job_Detail" />
- <asp:CommandField ShowInsertButton="True" />
- </Fields>
- </asp:DetailsView>
- <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="PrepressID"
- DataSourceID="ObjectDataSource1">
- <Columns>
- <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" />
- <asp:BoundField DataField="PrepressID" HeaderText="PrepressID" InsertVisible="False"
- ReadOnly="True" SortExpression="PrepressID" />
- <asp:BoundField DataField="Comp" HeaderText="Comp" SortExpression="Comp" />
- <asp:BoundField DataField="Job_Number" HeaderText="Job_Number" SortExpression="Job_Number" />
- <asp:BoundField DataField="Request_Date" HeaderText="Request_Date" SortExpression="Request_Date" />
- <asp:BoundField DataField="Customer" HeaderText="Customer" SortExpression="Customer" />
- <asp:BoundField DataField="Contact_Name" HeaderText="Contact_Name" SortExpression="Contact_Name" />
- <asp:BoundField DataField="Tel" HeaderText="Tel" SortExpression="Tel" />
- <asp:BoundField DataField="Email" HeaderText="Email" SortExpression="Email" />
- <asp:BoundField DataField="Media" HeaderText="Media" SortExpression="Media" />
- <asp:BoundField DataField="Job_Size" HeaderText="Job_Size" SortExpression="Job_Size" />
- <asp:BoundField DataField="Colors" HeaderText="Colors" SortExpression="Colors" />
- <asp:BoundField DataField="Number_of_Lots" HeaderText="Number_of_Lots" SortExpression="Number_of_Lots" />
- <asp:BoundField DataField="Proof" HeaderText="Proof" SortExpression="Proof" />
- <asp:BoundField DataField="Job_Detail" HeaderText="Job_Detail" SortExpression="Job_Detail" />
- </Columns>
- </asp:GridView>
- </form>
- </body>
- </html>
Any Idea please will be very appreciated.
Thank you very much!!