Insert using a submit button in ASP.NET doesn't work?
<p>Hello I have a bit of ASP.Net Code below. I am trying to figure out how to make my submit button:</p>

<pre><code> &lt;asp:Button ID="makepost" runat="server" Text="Post My Tip/Story" 
                ValidationGroup="createpost" /&gt;
</code></pre>

<p>work properly. When I try to add AccessDataSource1.Insert() I get an error saying this:</p>

<blockquote>
  <p>CS1061: 'ASP.main_aspx' does not contain a definition for
  'AccessDataSource1' and no extension method 'AccessDataSource1'
  accepting a first argument of type 'ASP.main_aspx' could be found (are
  you missing a using directive or an assembly reference?)</p>
</blockquote>

<p>What do I need to type to make this work? All of my code is below.</p>

<pre><code>&lt;%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="Main.aspx.cs" Inherits="Main" %&gt;

&lt;asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server"&gt;
&lt;/asp:Content&gt;
&lt;asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"&gt;
    &lt;asp:LoginView ID="LoginView1" runat="server"&gt;

    &lt;LoggedInTemplate&gt;
        &lt;asp:LoginStatus ID="LoginStatus1" runat="server" /&gt;
    &lt;div style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; color: #FFFFFF"&gt;
    &lt;p style="font-size: 20px"&gt;Welcome Back!&lt;br /&gt;
    Begin Sharing and Reading Space Tips Below!
    &lt;/p&gt;



    &lt;p&gt;&amp;nbsp;Current Posts:
        &lt;asp:GridView ID="GridView1" runat="server" DataSourceID="AccessDataSource1" 
            AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" 
            BackColor="#DEBA84" BorderColor="#DEBA84" BorderStyle="None" BorderWidth="1px" 
            CellPadding="3" CellSpacing="2" DataKeyNames="ID"&gt;
            &lt;RowStyle BackColor="#FFF7E7" ForeColor="#8C4510" /&gt;
            &lt;Columns&gt;
                &lt;asp:BoundField DataField="User" HeaderText="User" SortExpression="User" /&gt;
                &lt;asp:BoundField DataField="Title" HeaderText="Title" SortExpression="Title" /&gt;
                &lt;asp:BoundField DataField="Timeof" HeaderText="Timeof" 
                    SortExpression="Timeof" /&gt;
                &lt;asp:BoundField DataField="Post" HeaderText="Post" SortExpression="Post" /&gt;
                &lt;asp:CommandField ButtonType="Button" ShowDeleteButton="True" /&gt;
                &lt;asp:CommandField ButtonType="Button" ShowEditButton="True" /&gt;
            &lt;/Columns&gt;
            &lt;FooterStyle BackColor="#F7DFB5" ForeColor="#8C4510" /&gt;
            &lt;PagerStyle ForeColor="#8C4510" HorizontalAlign="Center" /&gt;
            &lt;SelectedRowStyle BackColor="#738A9C" Font-Bold="True" ForeColor="White" /&gt;
            &lt;HeaderStyle BackColor="#A55129" Font-Bold="True" ForeColor="White" /&gt;
        &lt;/asp:GridView&gt;

        &lt;asp:AccessDataSource ID="AccessDataSource1" runat="server" 
            DataFile="~/App_Data/Posts.mdb" 
            SelectCommand="SELECT * FROM [UserPost] ORDER BY [Timeof]" 
            DeleteCommand="DELETE FROM [UserPost] WHERE [ID] = ?" 
            InsertCommand="INSERT INTO [UserPost] ([ID], [User], [Title], [Timeof], [Post]) VALUES (?, ?, ?, ?, ?)" 
            UpdateCommand="UPDATE [UserPost] SET [User] = ?, [Title] = ?, [Timeof] = ?, [Post] = ? WHERE [ID] = ?"&gt;
            &lt;DeleteParameters&gt;
                &lt;asp:Parameter Name="ID" Type="Int32" /&gt;
            &lt;/DeleteParameters&gt;
            &lt;UpdateParameters&gt;
                &lt;asp:Parameter Name="User" Type="String" /&gt;
                &lt;asp:Parameter Name="Title" Type="String" /&gt;
                &lt;asp:Parameter Name="Timeof" Type="DateTime" /&gt;
                &lt;asp:Parameter Name="Post" Type="String" /&gt;
                &lt;asp:Parameter Name="ID" Type="Int32" /&gt;
            &lt;/UpdateParameters&gt;
            &lt;InsertParameters&gt;
                &lt;asp:ControlParameter Name="ID" Type="Int32" ControlID="TextBox5" PropertyName="Text" /&gt;
                &lt;asp:ControlParameter Name="User" Type="String" ControlID="TextBox1" PropertyName="Text" /&gt;
                &lt;asp:ControlParameter Name="Title" Type="String" ControlID="TextBox2" PropertyName="Text" /&gt;
                &lt;asp:ControlParameter Name="Timeof" Type="DateTime" ControlID="TextBox3" PropertyName="Text" ConvertEmptyStringToNull="true"/&gt;
                &lt;asp:ControlParameter Name="Post" Type="String" ControlID="TextBox4" PropertyName="Text"  /&gt;
            &lt;/InsertParameters&gt;
        &lt;/asp:AccessDataSource&gt;

    &lt;/p&gt;

        &lt;table&gt;&lt;tr&gt;&lt;td&gt; &lt;asp:Label ID="Label5" runat="server" Text="ID: "&gt;&lt;/asp:Label&gt;&lt;/td&gt;&lt;td&gt; 
            &lt;asp:TextBox ID="TextBox5" runat="server" ValidationGroup="createpost"&gt;&lt;/asp:TextBox&gt;&lt;/td&gt;&lt;/tr&gt;
        &lt;tr&gt;&lt;td&gt; &lt;asp:Label ID="Label1" runat="server" Text="User: "&gt;&lt;/asp:Label&gt;&lt;/td&gt;&lt;td&gt; 
            &lt;asp:TextBox ID="TextBox1" runat="server" ValidationGroup="createpost"&gt;&lt;/asp:TextBox&gt;&lt;/td&gt;&lt;/tr&gt;
        &lt;tr&gt;&lt;td&gt;&lt;asp:Label ID="Label2" runat="server" Text="Title: "&gt;&lt;/asp:Label&gt;&lt;/td&gt;&lt;td&gt;&lt;asp:TextBox ID="TextBox2"
                runat="server" ValidationGroup="createpost"&gt;&lt;/asp:TextBox&gt;&lt;/td&gt;&lt;/tr&gt;
        &lt;tr&gt;&lt;td&gt;&lt;asp:Label ID="Label3" runat="server" Text="Date: "&gt;&lt;/asp:Label&gt;&lt;/td&gt;&lt;td&gt; &lt;asp:TextBox ID="TextBox3"
                runat="server"&gt;&lt;/asp:TextBox&gt;&lt;/td&gt;&lt;/tr&gt;
        &lt;tr&gt;&lt;td valign="top"&gt;&lt;asp:Label ID="Label4" runat="server" Text="Story: "&gt;&lt;/asp:Label&gt;&lt;/td&gt;&lt;td valign="top"&gt;
            &lt;asp:TextBox ID="TextBox4" runat="server" Height="129px" Width="474px" TextMode="MultiLine"&gt;&lt;/asp:TextBox&gt;&lt;/td&gt;&lt;/tr&gt;
        &lt;/table&gt;
            &lt;asp:Button ID="makepost" runat="server" Text="Post My Tip/Story" 
                ValidationGroup="createpost" /&gt;&lt;br /&gt;

    &lt;/div&gt;

    &lt;/LoggedInTemplate&gt;&lt;AnonymousTemplate&gt;

        &lt;asp:Login ID="Login1" runat="server" ForeColor="White"&gt;
        &lt;/asp:Login&gt;&lt;br /&gt;&lt;div style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; color:#FFFFFF"&gt;Please Register to be begin viewing and sharing your 
        &lt;br /&gt;Star Wars Old Republic Tips and Stories!&lt;/div&gt;
    &lt;/AnonymousTemplate&gt;
    &lt;/asp:LoginView&gt;
&lt;/asp:Content&gt;
</code></pre>
