DataExpress 中的 Database 在配置好
链接的情况下
如何 与已知字符串比较 是不是 这样啊?建议去试一试这个家伙。 private void jbInit() throws Exception {
contentPane = (JPanel) getContentPane();
contentPane.setLayout(xYLayout1);
setSize(new Dimension(400, 300));
setTitle("Welcome");
db.setConnection(new ConnectionDescriptor(
"jdbc:mysql://localhost:3306/test?characterEncoding=utf-8",
"root", "pass", false, "com.mysql.jdbc.Driver"));
db.setDatabaseName("");
commit.setText("ok");
commit.addActionListener(new LoginFream_jButton1_actionAdapter(this));
column1.setColumnName("NewColumn1");
column1.setDataType(com.borland.dx.dataset.Variant.STRING);
column1.setExportDisplayMask("");
column1.setServerColumnName("NewColumn1");
column1.setSqlType(0);
contentPane.add(txtname, new XYConstraints(105, 70, 157, 25));
contentPane.add(txtpassword, new XYConstraints(105, 106, 156, 24));
contentPane.add(commit, new XYConstraints(106, 215, -1, -1));
}
//database1 为 拉过的来的database 控件
public void jButton1_actionPerformed(ActionEvent e) {
database1.openConnection();
database1.createStatement();
int i=database1.executeStatement("select * from users where id=1");
if (i!=0) {
this.jLabel1.setText("ok"+ i);
}
database1.closeConnection(); //database1 控件在配置测试时候可以连接数据库
}
这样又给我爆错了:
Exception in thread "AWT-EventQueue-0" See com.borland.dx.dataset.DataSetException error code: BASE+66
com.borland.dx.dataset.DataSetException: Can not issue SELECT via executeUpdate().
at com.borland.dx.dataset.DataSetException.a(Unknown Source)
at com.borland.dx.dataset.DataSetException.throwException(Unknown Source)
at com.borland.dx.dataset.DataSetException.SQLException(Unknown Source)
at com.borland.dx.sql.dataset.Database.executeStatement(Unknown Source)
链接的情况下
如何 与已知字符串比较 是不是 这样啊?建议去试一试这个家伙。 private void jbInit() throws Exception {
contentPane = (JPanel) getContentPane();
contentPane.setLayout(xYLayout1);
setSize(new Dimension(400, 300));
setTitle("Welcome");
db.setConnection(new ConnectionDescriptor(
"jdbc:mysql://localhost:3306/test?characterEncoding=utf-8",
"root", "pass", false, "com.mysql.jdbc.Driver"));
db.setDatabaseName("");
commit.setText("ok");
commit.addActionListener(new LoginFream_jButton1_actionAdapter(this));
column1.setColumnName("NewColumn1");
column1.setDataType(com.borland.dx.dataset.Variant.STRING);
column1.setExportDisplayMask("");
column1.setServerColumnName("NewColumn1");
column1.setSqlType(0);
contentPane.add(txtname, new XYConstraints(105, 70, 157, 25));
contentPane.add(txtpassword, new XYConstraints(105, 106, 156, 24));
contentPane.add(commit, new XYConstraints(106, 215, -1, -1));
}
//database1 为 拉过的来的database 控件
public void jButton1_actionPerformed(ActionEvent e) {
database1.openConnection();
database1.createStatement();
int i=database1.executeStatement("select * from users where id=1");
if (i!=0) {
this.jLabel1.setText("ok"+ i);
}
database1.closeConnection(); //database1 控件在配置测试时候可以连接数据库
}
这样又给我爆错了:
Exception in thread "AWT-EventQueue-0" See com.borland.dx.dataset.DataSetException error code: BASE+66
com.borland.dx.dataset.DataSetException: Can not issue SELECT via executeUpdate().
at com.borland.dx.dataset.DataSetException.a(Unknown Source)
at com.borland.dx.dataset.DataSetException.throwException(Unknown Source)
at com.borland.dx.dataset.DataSetException.SQLException(Unknown Source)
at com.borland.dx.sql.dataset.Database.executeStatement(Unknown Source)
database1.openConnection();
database1.createStatement();
写就不行了 , 问题已解决了。谢谢关注
java.sql.Statement stmt=db.createStatement();
java.sql.ResultSet rs = stmt.executeQuery("select * from users"); 写就好了,如果你们有别的解决方案告诉我哦。
thanks