none
can any one tell me what is wrong in this code ... i am trying to save data in db.. it does not give any error but it is not going in dbms.. RRS feed

  • General discussion

  • private void button1_Click_2(object sender, EventArgs e)
            {
                string connetionString = null;
                OleDbConnection cnn;


                connetionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|Personal_exp.accdb";
                cnn = new OleDbConnection(connetionString);
                 cnn.Open();
                string query = "INSERT into [Accounts](Account_name) values ('"+ textBox1.Text +"')";
                OleDbCommand cmd = new OleDbCommand();

                cmd.Connection = cnn;
                cmd.CommandType = System.Data.CommandType.Text;
                cmd.CommandText = query;
                cmd.ExecuteNonQuery();

                cnn.Close();

                MessageBox.Show("Added");
    • Moved by Rowan Miller Thursday, March 24, 2011 9:07 PM (From:ADO.NET Entity Framework and LINQ to Entities (Pre-Release))
    Tuesday, March 22, 2011 3:52 AM

All replies