i want import Excel work sheet into ms acess existing table
string conn = "Provider=Microsoft.ACE.OLEDB.12.0;" + "Data Source=" + filename + ";" + "Extended Properties=Excel 12.0 Xml;";
OleDbConnection con = new OleDbConnection(conn);
OleDbCommand cmd = new OleDbCommand();
cmd.CommandText = @"SELECT * INTO [MS Access;Database=" + adb + "].[test] FROM [test$]";
cmd.Connection = con;
catch (DbException ex)
MessageBox.Show("Failed to access database");
but its create new table and insert values?
how i insert existitg existing databases ms access
ok, im not sure what you want, but i'll try. Your question is, you want to insert data into an existing table?
Your SQL command "select into" creates a new table of data, that is not the command that you should be using.
You can write an "INSERT INTO (select * from....)
where your select statement in the brackets would be your subquery, the selection of what you want from the excel file, and inserted into an existing table.