SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]第 1 行: '='
附近有语法错误。-我找了很久没有找到,请指教!
import java.sql.*;
public class UpdateTable{
public static void main(String args[]){
String dbUrl = "jdbc:microsoft:sqlserver://XIAO:1433;DatabaseName=tset";
String user = "sa";
String password = "123";
String UpdateString = "update COFFEES " +
"set SALES = 100 " +
"set TOTAL = TOTAL+100 " +
"where COF_NAME like 'Colombian' ";
try
{
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
}catch(java.lang.ClassNotFoundException e){
System.out.print("ClassNotFoundException: ");
System.out.println(e.getMessage());
}
try
{
Connection cn=DriverManager.getConnection(dbUrl,user,password);
Statement s=cn.createStatement();
int n=s.executeUpdate(UpdateString);
//System.out.println(n);
s.close();
cn.close();
}catch(SQLException ex){
System.out.println("SQLException: "+ex.getMessage());
}
}
}
附近有语法错误。-我找了很久没有找到,请指教!
import java.sql.*;
public class UpdateTable{
public static void main(String args[]){
String dbUrl = "jdbc:microsoft:sqlserver://XIAO:1433;DatabaseName=tset";
String user = "sa";
String password = "123";
String UpdateString = "update COFFEES " +
"set SALES = 100 " +
"set TOTAL = TOTAL+100 " +
"where COF_NAME like 'Colombian' ";
try
{
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
}catch(java.lang.ClassNotFoundException e){
System.out.print("ClassNotFoundException: ");
System.out.println(e.getMessage());
}
try
{
Connection cn=DriverManager.getConnection(dbUrl,user,password);
Statement s=cn.createStatement();
int n=s.executeUpdate(UpdateString);
//System.out.println(n);
s.close();
cn.close();
}catch(SQLException ex){
System.out.println("SQLException: "+ex.getMessage());
}
}
}
解决方案 »
- 如何从string中截取字符串
- 高手看看SQLServer 2000 Driver for JDBC]Error establishing socket问题怎么解决?
- 再次发关于jfreeChart的帖子(怎么样可以把柱体的宽度设置宽一些)
- 画股票走势图,是直接在JPanel上画,还是在Cavas上画,再放到JPanel上?
- wwm1978请进,接分
- 关于定义接口的一些问题??
- 有关线程的小问题
- 为什么File对象有时候不能删除文件??有什么方法确保一定可以删除文件地??
- 请教高手HTTPURLConnection的问题
- 周一交差,大侠救命!!!!
- linux下j2se的配置问题。
- 分配数组空间的时候可以使用带参数的构造函数吗?
"set SALES = 100 " +
"set TOTAL = TOTAL+100 " +
"where COF_NAME like 'Colombian' ";
这句你用两格set干什么,改成下面这样试下:
String UpdateString = "update COFFEES " +
"set SALES = 100 ," +
"TOTAL = TOTAL+100 " +
"where COF_NAME like 'Colombian' ";