sy l

sy l

  • NA
  • 5
  • 11.2k

bulk insert to ms access with csv file

Jul 23 2010 12:22 AM
i try to bulk insert data to ms access db from a csv file.
below my code

DbCommand selectCommand = factory.CreateCommand();
selectCommand.CommandText = @"SELECT * INTO [MS Access;Database=C:\mydb.mdb].[table1] FROM [abc$]";
selectCommand.ExecuteNonQuery();

it work for import excel file, but when i try to input a csv file as below code, it failed

selectCommand.CommandText = @"SELECT * INTO [MS Access;Database=C:\mydb.mdb].[table1] FROM [abc.csv]";
selectCommand.ExecuteNonQuery();

error "Query input must contain at least one table or query."

pls help...


Answers (2)