I am new to ASP.net as of today :)

I have jumped many hunrdles alreday, writing/deleting text files, connecting to a db, sendiong emails, yeah me.

I am looking for 1 concise example to show how i can take the contents of a form and insert them into a datbase. i am having the worst time trying to find a tutorial or example that explains this is a way that makes sense and that also works.

please, can someone help me?

i just need a straight up form that has like name, last name, phjone and emial, that can store it into a database - right now im using a MYSQL db, but if i can see it in access, i should be able to convert.

thanks!
~ Andrea

use the formview control and bind it to a datasource control which is configured to access your database.
If you use VS2005 they are there and very simple to setup (follow the wizards). Drop a form view onto your page, where it says datasource use the drop down to make a new one and follow the wizard to configure the datasource to do selects, updates, inserts and deletes to your database.

When it is all done and working properly you will be able to see the code it created and understand what it did and then you can roll your own at any time.

The datasource is a powerful tool, especially the object datasource if you are using multi tier applications

I am not using VS2005. I am basically using Notepad, well, ok, an HTML editor....

so, I appreciate the help f1 fan, but it really didn't do too much for me :) i just need a straight up example of asp.net form and inserting the results into a db, preferabbly SQL :)

OK
You can get webdeveloper express which is free and makes it a lot easier.
the code below has a grid view which lets me list, edit and delete items in the grid (it could select too but i have no need of that in this example).
grid views dont allow news rows so i use a details view (below it) which is in default mode of insert.
Both are bound to the sqldatasource which you see below them. In my case i have the connection string elsewhere in my app which it knows to go find by the <%$ ... %> tags. You can use stored procs etc but i included this code for you to see
Hope it helps you

<asp:GridView ID="GridView1" runat="server" AllowPaging="True"
        AutoGenerateColumns="False" DataKeyNames="aID" DataSourceID="SqlDataSource1" Caption="Collections" Width="300px">
        <Columns>
            <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" />
            <asp:BoundField DataField="aID" HeaderText="aID" ReadOnly="True" SortExpression="aID" Visible="False" />
            <asp:BoundField DataField="CollectionName" HeaderText="Collection Name" SortExpression="CollectionName" />
        </Columns>
    </asp:GridView><br /><br />
    <asp:DetailsView ID="DetailsView1" runat="server" AllowPaging="True" AutoGenerateRows="False"
        DataKeyNames="aID" DataSourceID="SqlDataSource1" DefaultMode="Insert" Height="50px"
        Width="300px" Caption="Add New Collection">
        <Fields>
            <asp:BoundField DataField="aID" HeaderText="aID" ReadOnly="True" SortExpression="aID" Visible="False" />
            <asp:BoundField DataField="CollectionName" HeaderText="Collection Name" SortExpression="CollectionName" />
            <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" ShowInsertButton="True" />
        </Fields>
    </asp:DetailsView>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConflictDetection="CompareAllValues"
        ConnectionString="<%$ ConnectionStrings:CHComConnectionString %>" DeleteCommand="DELETE FROM [Collections] WHERE [aID] = @original_aID AND [CollectionName] = @original_CollectionName"
        InsertCommand="INSERT INTO [Collections] ([aID], [CollectionName]) VALUES (newid(), @CollectionName)"
        OldValuesParameterFormatString="original_{0}" SelectCommand="SELECT [aID], [CollectionName] FROM [Collections] order by [CollectionName]"
        UpdateCommand="UPDATE [Collections] SET [CollectionName] = @CollectionName WHERE [aID] = @original_aID AND [CollectionName] = @original_CollectionName">
        <DeleteParameters>
            <asp:Parameter Name="original_aID" Type="Object" />
            <asp:Parameter Name="original_CollectionName" Type="String" />
        </DeleteParameters>
        <UpdateParameters>
            <asp:Parameter Name="CollectionName" Type="String" />
            <asp:Parameter Name="original_aID" Type="Object" />
            <asp:Parameter Name="original_CollectionName" Type="String" />
        </UpdateParameters>
        <InsertParameters>
            <asp:Parameter Name="CollectionName" Type="String" />
        </InsertParameters>
    </asp:SqlDataSource>

I would serriously look into the webdevolper express. I think you will fall in love with it plus it just makes everything much more organized. Just my two cents

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.