Results 1 to 4 of 4

Thread: How to write the form values in Database using C#

  1. #1
    Join Date
    Apr 2009
    Posts
    65

    How to write the form values in Database using C#

    How to write the form values in Database using C#, I have a simple form (text fields and pull down menus), I have not keep more customization in my existing form and I want to insert the values from the form into an sql database. This is because i have just now started my ASP.NET classes. Do we need to simply insert the values in the database as we inserted into table or there any specific method to do it.

  2. #2
    Join Date
    Feb 2008
    Posts
    180

    Re: How to write the form values in Database using C#

    In your submit button, you have to hook onto an "OnClick" event (in visual studio, double click the button, and it'll create it for you), in there, I managed to get the program to connect to the sql database but how do I set up the insert statement? I have dropdown, radiobuttons and text fields, you can get all the values from your text field and then insert the data into your database using whatever data access method you prefer.

  3. #3
    Join Date
    Feb 2009
    Posts
    117

    Re: How to write the form values in Database using C#

    Start by creating a new Windows Application titled Data Form Example. C# does not make use of header files; it uses namespaces to accomplish this purpose. Choose Add Windows Form from the Project menu to display the Add New Item dialog box, click the Data Form Wizard icon, change the name to fclsDataForm.cs Like every Win32 application source, we will start with the inclusion of some header files. The Data Form Wizard is run by adding it to your project as a form template.

  4. #4
    Join Date
    Dec 2008
    Posts
    128

    Re: How to write the form values in Database using C#

    Don't you alreay use Request.fomr to retrive this value. Also once you stored these values in application variables they are available from anywhere. You need to defined a connection to the Contacts database, your drop-down list will be empty. Click the New Connection button to display the Data Link Properties dialog box.NOTE that I would put this rather in session as application variables are shared by all sessions and this could result in a problem if multiple users are logging at the same time.

Similar Threads

  1. Need C# script to Read and Write Lines over large database
    By Budhil in forum Software Development
    Replies: 2
    Last Post: 25-05-2012, 04:54 PM
  2. Increasing primary key values in database
    By Aileen_L in forum Software Development
    Replies: 4
    Last Post: 06-02-2010, 04:28 PM
  3. How to Get the values from the database in ASP?
    By - Empty Shell - in forum Software Development
    Replies: 5
    Last Post: 03-02-2010, 02:33 AM
  4. Replies: 1
    Last Post: 30-01-2010, 03:29 AM
  5. Replies: 3
    Last Post: 09-07-2009, 05:12 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,938,791.18551 seconds with 17 queries