-1
JDBC空指針錯誤。同時訪問數據庫。這是我正在執行的查詢。JDBC和MS-Access空指針
"INSERT INTO paritosh (customer, contactPerson, mobileNo, phoneNo, emailId, chairman, instituteName, totalEmployees, totalFaculty, totalStudents, totalClassroom, address, state, revenue, clientRate, acceptedRate, valuePerCard, rating, finderName, finderFee, comments) VALUES ('kinley', 'adfa' , '232131' , '2323' , '@gmail' , 'adfadf' , 'zxc' ,100,11,1000,30, 'dfdfa' , 'Delhi' , 66000,60000,60000,600, 'Hot' , 'tyu' , 8, 'dfadfadfasdf');"
如果我執行的代碼,查詢中運行良好的訪問SQL查詢.....
請幫
的JDBC代碼如下:
String insertq="INSERT INTO paritosh (customer, contactPerson, mobileNo, phoneNo, emailId, chairman, instituteName, totalEmployees, totalFaculty, totalStudents, totalClassroom, address, state, revenue, clientRate, acceptedRate, valuePerCard, rating, finderName, finderFee, comments)";
String query=" VALUES ('"+customer+"', '"+contact+"' , '"+mobile+"' , '"+phone+"' , '"+email+"' , '"+chairman+"' , '"+institute+"' ,"+totalEmployees+","+totalFaculty+","+totalStudents+","+classroom+", '"+address+"' , '"+state+"' , "+revenue+","+clientRate+","+accepRate+","+valPercard+", '"+Rating+"' , '"+finderName+"' , "+finderFee+", '"+comment+"');";
String build=insertq+query;
String query2="INSERT INTO paritosh (customer, contactPerson, mobileNo, phoneNo, emailId, chairman, instituteName, totalEmployees, totalFaculty, totalStudents, totalClassroom, address, state, revenue, clientRate, acceptedRate, valuePerCard, rating, finderName, finderFee, comments) VALUES ('virappan', 'dussal' , '4269887' , '12334567' , '[email protected]' , 'kumar' , 'RMIT' ,300,120,3000,150, 'adfad' , 'Delhi' , 400000,380000,390000,1500, 'Hot' , 'vineet' , 9, 'afddf');";
try{
s.execute(build);
}
catch(SQLException se)
{
System.out.println("SQL eception");
}
catch(Exception e)
{
System.out.println(e);
System.out.println(" error after running the query");
}
你能提供完整的堆棧跟蹤嗎?另外,你是否確定's'不是null? – Sujay 2012-07-24 15:11:04