c# - Cannot update data from Excel sheet to Access database -
here code need save data excel sheet database access using c#. don't error excel data not updated in database access.. have this?
my database access tablename "addsales1".
my excel sheet name "addsales1".
string file_name = application.startuppath + "\\" + "databaseset.txt"; system.io.streamreader objreader; objreader = new system.io.streamreader(file_name); string sh = objreader.readline(); string con = "provider=microsoft.ace.oledb.12.0;data source=" + textbox9.text + ";extended properties=excel 8.0;"; oledbconnection connection = new oledbconnection(con); oledbcommand cmd = new oledbcommand("insert [ms access;database=" + sh + "].[addsales1] select * [addsales1$]"); cmd.connection = connection; connection.open(); cmd.executenonquery(); connection.close(); messagebox.show("sales details imported successfully!");
Comments
Post a Comment