[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

ASP.NET - easiest way to insert records

Posted on 2012-03-21
1
Medium Priority
?
231 Views
Last Modified: 2012-03-23
Hi all.

What is the easiest way to insert record to database from asp.net web form ?

My form looks like this:

<asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <asp:MultiView ID="MultiView12" runat="server">
                <asp:View ID="Registracija1" runat="server">
                    <div class="center_title_bar">
                        Otvaranje novog naloga
                    </div>
                    <div class='forma_edit'>
                        <asp:ValidationSummary ID="ValidationSummary1" runat="server" CssClass="forma_edit_error_summary" />
                        <div class='forma_edit_tekst'>
                            Molimo Vas da unesete Vaše podatke. Polja oznacena sa * (zvjezdicom) je obavezno
                            unjeti.
                        </div>
                        <div class='forma_edit_name'>
                            Ime i Prezime*
                        </div>
                        <div class='forma_edit_field'>
                            <asp:TextBox ID='IKuDonameTXT' ClientIDMode="Static" runat='server' Width='420px'></asp:TextBox>
                            <asp:RequiredFieldValidator ErrorMessage="Morate upisati Ime i prezime" ControlToValidate="IKuDonameTXT"
                                CssClass="forma_edit_error" runat="server" />
                        </div>
                        <div class='forma_edit_name'>
                            Korisnicko ime*
                        </div>
                        <div class='forma_edit_field'>
                            <asp:TextBox ID='IWebSiteUsernameTXT' runat='server' Width='420px' />
                            <asp:RequiredFieldValidator ErrorMessage="Morate upisati korisnicko ime" ControlToValidate="IWebSiteUsernameTXT"
                              CssClass="forma_edit_error"   runat="server" />
                        </div>
                        <div class='forma_edit_descr'>
                            Ime koje cete koristiti kada se budete prijavljivali na sajt
                        </div>
                        <div class='forma_edit_name'>
                            Lozinka*
                        </div>
                        <div class='forma_edit_field'>
                            <asp:TextBox ID='IWebSitePasswordTXT' runat='server' Width='420px' />
                            <asp:RequiredFieldValidator ErrorMessage="Morate upisati lozinku" ControlToValidate="IWebSitePasswordTXT"
                               CssClass="forma_edit_error"  runat="server" />
                        </div>
                        <div class='forma_edit_name'>
                            JMBG*
                        </div>
                        <div class='forma_edit_field'>
                            <asp:TextBox ID='IKuDoPIBTXT' runat='server' Width='420px' />
                            <asp:RequiredFieldValidator ErrorMessage="Morate upisati JMBG" ControlToValidate="IKuDoPIBTXT"
                                CssClass="forma_edit_error" runat="server" Display="Dynamic" />
                        </div>
                        <div class='forma_edit_descr'>
                            Vas jedinstveni maticni broj (sluzi za provjeru Vasih podataka)
                        </div>
                        <div class='forma_edit_name'>
                            Mobilni Telefon*
                        </div>
                        <div class='forma_edit_field'>
                            <asp:TextBox ID='IKuDoTelefonMobilniTXT' runat='server' Width='420px' />
                            <asp:RequiredFieldValidator ErrorMessage="Morate upisati Mobilni telefon" ControlToValidate="IKuDoTelefonMobilniTXT"
                                CssClass="forma_edit_error" runat="server" />
                        </div>
                        <div class='forma_edit_name'>
                            Fiksni Telefon*
                        </div>
                        <div class='forma_edit_field'>
                            <asp:TextBox ID='IKuDoTelefonFiksniTXT' runat='server' Width='420px' />
                            <asp:RequiredFieldValidator ErrorMessage="Morate upisati Fiksni telefon" ControlToValidate="IKuDoTelefonFiksniTXT"
                                CssClass="forma_edit_error" runat="server" />
                        </div>
                        <div class='forma_edit_name'>
                            Adresa*
                        </div>
                        <div class='forma_edit_field'>
                            <asp:TextBox ID='IKuDoAdresaTXT' runat='server' Width='420px' />
                            <asp:RequiredFieldValidator ErrorMessage="Morate upisati adresu" ControlToValidate="IKuDoAdresaTXT"
                                CssClass="forma_edit_error" runat="server" />
                        </div>
                        <div class='forma_edit_descr'>
                            Vasa adresa u formatu Ulica i broj, Grad
                        </div>
                        <div class='forma_edit_name'>
                            Email adresa
                        </div>
                        <div class='forma_edit_field'>
                            <asp:TextBox ID='IEmailTXT' runat='server' Width='420px' />
                        </div>
                        <div class="forma_edit_komanda_insert">
                            <asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" Text="Sacuvaj" />
                        </div>
                    </div>
                </asp:View>
                <asp:View ID="Zavrseno" runat="server">
                    Uspjesno ste se registrovali. Molimo Vas da se ulogujete na vrhu stranice.
                </asp:View>
            </asp:MultiView>
        </ContentTemplate>
    </asp:UpdatePanel>

Open in new window


As you see, all fields are required except the last one (IEmailTXT).

Validation is working as it should, but now I need to do the inserting part.

What is the best way to do it ? I am using access database.

This is my insert command:

"INSERT INTO KuDo (KuDoID,KuDoNaziv,WebSiteUsername,WebSitePassword,KuDoPIB,KuDoTelefonMobilni,KuDoTelefonFiksni,KuDoAdresa,KuDoEmail) VALUES (@KuDoID,@KuDoNaziv,@WebSiteUsername,@WebSitePassword,@KuDoPIB,@KuDoTelefonMobilni,@KuDoTelefonFiksni,@KuDoAdresa,@KuDoEmail)"
0
Comment
Question by:mccom
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 20

Accepted Solution

by:
BuggyCoder earned 1500 total points
ID: 37746110
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Suggested Courses

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question