locked
Saving the contents of textboxes and dropdowns to an Access Database RRS feed

  • Question

  • User-430157385 posted

    Can anyone help me with this. I have looked at tons of videos but they always do simple and basic stuff so I can never learn how to do it. Does anyone here know of any tutorials (documents, videos...etc.....) or anything like that to help me with this.

    Thanks in advance

    Saturday, June 30, 2012 1:30 AM

Answers

  • User3866881 posted

    Saving the contents of textboxes and dropdowns to an Access Database

    If your TextBoxes as well as Dropdownlists are all out of a certain presentation control, you can just find them by referring their name and do directly inserting:

    using (OleDbCommand cmd = new OleDbCommand(“insert into xxx (field1,field2,……,fieldN) valeus(@field1,@field2,……,@fieldN”,new OleDbConnection("Your Conn Str")))
    {
       cmd.Parameters.AddWithValue("@field1",TextBox1.Text);
       ………………
       cmd.Parameters.AddWithValue("@fieldN",Dropdownlist1.SelectedValue);
    }

    But if you use TextBoxes and Dropdownlists inside some presentation controls such as GridView,you should enable CRUD methods successfully and then make the GridView editable,and then do Updating or Inserting——However GridView isn't supporting inserting directly, I think you can use GridView's FooterRow——

    Sample is here:

    http://geekswithblogs.net/casualjim/archive/2006/05/04/77151.aspx

    http://www.codeproject.com/Articles/16036/GridView-with-insert-line

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, July 1, 2012 9:45 PM

All replies

  • User306743125 posted

    Use a FormView.

    There will be tons of tutorials if you search for asp.net FormView.

    Once you've managed that search for ItemTemplates and Dropdownlists in Formviews

    Saturday, June 30, 2012 1:33 AM
  • User3866881 posted

    Saving the contents of textboxes and dropdowns to an Access Database

    If your TextBoxes as well as Dropdownlists are all out of a certain presentation control, you can just find them by referring their name and do directly inserting:

    using (OleDbCommand cmd = new OleDbCommand(“insert into xxx (field1,field2,……,fieldN) valeus(@field1,@field2,……,@fieldN”,new OleDbConnection("Your Conn Str")))
    {
       cmd.Parameters.AddWithValue("@field1",TextBox1.Text);
       ………………
       cmd.Parameters.AddWithValue("@fieldN",Dropdownlist1.SelectedValue);
    }

    But if you use TextBoxes and Dropdownlists inside some presentation controls such as GridView,you should enable CRUD methods successfully and then make the GridView editable,and then do Updating or Inserting——However GridView isn't supporting inserting directly, I think you can use GridView's FooterRow——

    Sample is here:

    http://geekswithblogs.net/casualjim/archive/2006/05/04/77151.aspx

    http://www.codeproject.com/Articles/16036/GridView-with-insert-line

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, July 1, 2012 9:45 PM