Hi
I am trying to do a basic insert into an Access database (I have done this via MSSQL before and it was fine). I have done this with asp.old and no problems.
I am now using Access 2007 and C#.
-
string strConn = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=D:\Domains\xxx.com\App_Data\customers.accdb; Persist Security Info=False;";
-
-
-
string strInsert = "INSERT INTO Customers ([FirstName], [LastName], [EmailAddress]) VALUES ('FN', 'LN', 'Email@email.com')";
-
-
-
OleDbConnection oleConn = new OleDbConnection();
-
OleDbCommand oleCmd = new OleDbCommand();
-
OleDbDataAdapter oleDA = new OleDbDataAdapter();
-
-
oleCmd.CommandText = strInsert;
-
oleCmd.CommandType = CommandType.Text;
-
oleCmd.Connection = oleConn;
-
oleConn.ConnectionString = strConn;
-
-
oleDA.SelectCommand = oleCmd;
-
-
oleConn.Open();
-
-
Response.Redirect("website.aspx");
I run the page and click the button which runs the code above! I know it's getting to the end as the redirect works!! My database does not alter!
It's almost as if it's ignored everything! What have I done wrong! I know I must have missed something!