Sending <select> to MS Access Database

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • 16a9
    New Member
    • Apr 2020
    • 1

    Sending <select> to MS Access Database

    The title says it all.
    i've inserted my database tables into the select options , and now i want when the Client select options get inserted into a table.
    Just to clear your minds on what is going on . i'm working on an order form that takes select options from different tables
    becouse i want to make an Admin control page in the future (So he can easily controll all the addons exc).

    I made 4 functions on the aspx.cx
    which all call the tables on Databases and fill them with the info.
    and on the Page load function i called all 4 functions (since i have 4 tables).

    and i made a button to call btn function that insert tha data into the table but it seems not to be working.
    Code:
                               
         <asp:Button Text="Click me to Order!" ID="MyButton" runat="server" OnClick="btn" />
    Code:
     public void order()
            {
    
                Random rnd = new Random();
                int id = rnd.Next(1, 123456789);
                string adds3 = tosfot.Value;
                string btsek3 = btsek.Value;
                string size3 = size.Value;
                string kind3 = kind.Value;
                string name12 = name1.Text;
                string phone = phonenumber.Text;
                string email12 = email1.Text;
                string strDb;
                strDb = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=D:\Database\site.accdb;" +
                        "Persist Security Info=False";
                OleDbConnection conn9 = new OleDbConnection(strDb);
                conn9.Open();
                OleDbCommand cmd = conn9.CreateCommand();
                cmd.CommandText = "INSERT INTO orders VALUES ('" + id + "','" + name12 + "','" + email12 + "','" +
                                  phone + "','" + btsek3 + "','" + adds3 + "','" + size3 + "','" + kind3 +
                                  "',120);";
                cmd.ExecuteNonQuery();
                conn9.Close();
    
    
            }
Working...