我开发了一个与ms sql数据库连接的android应用程序,当我尝试插入数据时,它没有显示任何错误但是没有插入sql数据。请帮我。我使用androidstudio 3.0.1,Ms-sql R2数据库,jtds 1.3.1.jar用于jdbc连接。请帮我在数据库中插入数据。
protected String doInBackground(String... params)
{
String item = params[0];//username.getText().toString();
String batch =params[1]; //password.getText().toString();
String mtrs = params[2];
String design = params[3];
ConnectDb db = new ConnectDb();
try
{
con = db.connectionclass(); // Connect to database
if (con == null)
{
z = "Check Your Internet Access!";
}
else
{
String query = "insert into [CE] values ('Null','Null','Null','item','batch','design','mtrs')";//"INSERT INTO [CE]VALUES"+"('"+barcode+"','"+rack+"','"+selves+"','"+item+"','"+batch+"','"+design+"','"+mtrs+"')";
Statement stmt = con.createStatement();
int rst = stmt.executeUpdate(query);
if(rst!=0)
{
z="Inserted rows"+rst;
isSuccess=true;
con.close();
}
else
{
z = "Invalid Credentials!";
isSuccess = false;
}
}
}
catch (Exception ex)
{
isSuccess = false;
z = ex.getMessage();
}
return z;
}}
}