ksj12
ksj12
2016-02-17 15:36

将截断字符串或二进制数据问题,Java,sql

5
  • 数据
  • java

我开的长度足够大了,可是还是报错

 ![图片说明](https://img-ask.csdn.net/upload/201602/17/1455723342_499331.png)

public void actionPerformed(ActionEvent e) {
if(e.getSource()==jb1){
Connection ct=null;
Statement stm=null;
PreparedStatement ps=null;
ResultSet rs=null;
//Statement stmt=null;
try {
//加载驱动
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");

            //创建连接对象
            String url="jdbc:sqlserver://localhost:1433;databaseName=master";
            //注册驱动程序,打开连接
            ct=DriverManager.getConnection(url,"sa","ksj123456.");
            //预编译语句对象
            String  sql="insert into stu values(?,?,?,?,?,?)";
             ps=ct.prepareStatement(sql);
        //参数赋值
        ps.setString(1, jtf1.getText());
        ps.setString(2, jtf1.getText());
        ps.setString(3, jtf1.getText());
        ps.setString(4, jtf1.getText());
        ps.setString(5, jtf1.getText());
        ps.setString(6, jtf6.getText());
        //执行操作
        ps.executeUpdate();
        this.dispose();

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

6条回答