Hi All,
I can't insert java variable into ms access database.
I'm using odbc connection to ms access.
Below are my coding.
When I change the variable to values like ('11','12','13' ,'14','345','34 5','456','3456' );");
It able to insert into access.
Kindly please help look into the problem.
Thanks and Regards,
Crispin Yeap
I can't insert java variable into ms access database.
I'm using odbc connection to ms access.
Below are my coding.
Code:
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
// set the connection for database path
String Database_Path = "E:/Segi/Project/Coding/Car_Park_Storage.mdb";
String Storage = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=";
Storage+= Database_Path.trim() + ";DriverID=22;READONLY=true}";
Connection Connect = DriverManager.getConnection( Storage ,"","");
Statement Insert = Connect.createStatement();
//int date_in = Integer.parseInt(Show_Date_In);
//int times_in = Integer.parseInt(Show_Times_In);
Insert.execute("insert into Daily_Details values(Car_Number,Parking_Lot,'13','14','345','345','456','3456');");
Insert.close();
Connect.close();
}
It able to insert into access.
Kindly please help look into the problem.
Thanks and Regards,
Crispin Yeap
Comment