*Access database*
OleDbConnection con = new
OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=
|DataDirectory|MyAccessDB.mdb");
OleDbDataAdapter da = new OleDbDataAdapter();
da.InsertCommand = new OleDbCommand("Insert into products
Values('soap',100)", con);

            con.Open();
            MessageBox.Show(da.InsertCommand.ExecuteNonQuery().ToString());
 // returns a msg box showing 1
            con.Close();


*Sql database*
SqlConnection con = new SqlConnection("Data Source=Home-PC;Initial
Catalog=SqlServerDB;Integrated Security=TRUE;User Id=Me;Password=apple");
SqlDataAdapter daS = new SqlDataAdapter();
daS.InsertCommand = new SqlCommand("Insert into products
Values('soap',100)", con);

            con.Open();
            MessageBox.Show(da.InsertCommand.ExecuteNonQuery().ToString());
 // returns a msg box showing 1
            con.Close();

// In sql DB query get executed and i can see the results in sql server DB.
But in access db, though its not giving any errors its not get executed and
i dnt see the results in access DB. what am I doing wrong here??



-- 
--
ප්‍රශාන් ප්‍රනාන්දු | Prashan Fernando
" I may not the best, but different from the rest "

Reply via email to