views:

37

answers:

3

I am new to asp.net, looking for a tutorial that will teach me how to make a web registration form with many textboxes, dropdowns etc and submit this information into the database tables on the user pressing the submit button.

I've searched but so far come up with nothing.

+2  A: 

How did you search?

asp.net/learn

has everything you need to learn to start working with databases.

Shoban
its easy to post a general link and a cockey comment isnt it? Thats called being a troll. What I am asking is for a link to a specific tutorial as I am having problems finding one! As a beginner!!
James Khan
Interestingly, there are 20+ tutorials on that page. What's wrong with 20+ tutorials? What specific issues do you have with that list of tutorials?
S.Lott
+2  A: 

Go on this page and you will find some nice video tutorial where you can pick some concepts also

added:

My advice to you would be not to judge good answers as asp.net by author who post them, also if the answer does not help you should contribute and tell us what site does not contain what would be helpful to you.

best regards.

SonOfOmer
I gave him the same link which he doesn't like ;)
Shoban
A sorry a did not see, Bob Tabor is must like :)
SonOfOmer
Its you i dont like shoban
James Khan
+1  A: 

If you look at the data access part of asp.net/learn there's a ton of tutorials specifically surrounding data access through asp.net, although from what you've posted I suspect that this is "over-complicated" for what you're after.

At its simplest what you want to do is have your aspx page, lets call it default.aspx and have the following in it:

<asp:TextBox runat="server" ID="myTextBox">
</asp:TextBox>
<asp:Button runat="server" ID="myButton" OnClick="myButton_OnClick" Text="Click to save" />

Now in your codebehind file (the .aspx.cs file) you'll want to have an event handler for the Click event of myButton

protected void myButton_Click(object sender, EventArgs e)
{
    var myConnectionString = "Connection String goes here";
    using (SqlConnection conn = new SqlConnection(myConnectionString))
    {
        using (SqlCommand cmd = new SqlCommand("INSERT INTO dbo.mytable (fieldName) VALUES (@value1)", conn))
        {
            cmd.Parameters.Add(new SqlParameter("@value1", myTextBox.Text));
            cmd.ExecuteNonQuery();
        }
    }
}

The example code above, for doing the database work, is very rudimentary and I strongly suggest you read some of the tutorials on asp.net/learn and elsewhere on the net (perhaps even the msdn documentation for SqlCommand, SqlParameter and SqlConnection) to familiarise yourself with what they are and how they work.

Rob