Java结果:-1073740940-我在运行代码时得到了这个结果,现在我所有的代码都不会运行了
所以我有这个密码。。我运行它并给出了以下消息 运行: Java结果:-1073740940 构建成功总时间:21秒 在那之后。。即使是以前所有正常工作的项目也无法运行。他们都给了我同样的结果。我已经到处寻找解决方案,但论坛上的人甚至没有一个人在任何人提出问题的时候都能得到这个问题 这是密码。。朗,我知道。。但我希望这能有所帮助。当我将SQL连接添加到“注册”按钮并编写saveName函数时,错误就开始了Java结果:-1073740940-我在运行代码时得到了这个结果,现在我所有的代码都不会运行了,java,jdbc,Java,Jdbc,所以我有这个密码。。我运行它并给出了以下消息 运行: Java结果:-1073740940 构建成功总时间:21秒 在那之后。。即使是以前所有正常工作的项目也无法运行。他们都给了我同样的结果。我已经到处寻找解决方案,但论坛上的人甚至没有一个人在任何人提出问题的时候都能得到这个问题 这是密码。。朗,我知道。。但我希望这能有所帮助。当我将SQL连接添加到“注册”按钮并编写saveName函数时,错误就开始了 import java.sql.*; import java.util.logging.Le
import java.sql.*;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.lang.Exception.*;
public class SmartStock extends JFrame implements ActionListener{
Connection conn = null;
Statement stmt = null;
public void saveName(String FirstName,String LastName,String SurName, String Password) throws SQLException{
String url = "jdbc:sqlserver//:localhost:1433/USERS";
String driver = "com.microsoft.sqlserver.jdbc.SQLServerDriver";
String userName = "";
String password = "";
try {
Class.forName(driver);
conn = DriverManager.getConnection(url, userName, password);
stmt = conn.createStatement();
stmt.executeUpdate("INSERT INTO USER_PERSONAL_DETAILS(forename, lastname, surname, password) VALUES ('','"+txtFName.getText()+ "','" +txtLName.getText()+"','"+txtSName.getText()+"','"+nwpassword.getText()+"'");
}catch (ClassNotFoundException ex) {
Logger.getLogger(SmartStock.class.getName()).log(Level.SEVERE, null, ex);
} catch (SQLException ex) {
Logger.getLogger(SmartStock.class.getName()).log(Level.SEVERE, null, ex);
}
}
//In here is the JFrame for the code.. Long so I trimmed it off.
public void actionPerformed(ActionEvent e){
if(e.getSource()==btnSignup){
String fname = txtFName.getText();
String lname=txtLName.getText();
String sname=txtSName.getText();
String pword=nwpassword.getText();
try{
saveName(fname,lname,sname,pword);
} catch (SQLException ex) {
Logger.getLogger(SmartStock.class.getName()).log(Level.SEVERE, null, ex);
}
new SignUp();
dispose();
}
else if(e.getSource()==btnExit){
System.exit(0);
}
}
}
你的标题应该更具描述性。你的问题似乎是关于JDBC的。请精简您的代码并删除与问题无关的所有内容。Swing和AWT与数据库访问无关。完成..也编辑了标题。到底是什么问题?有例外吗?堆栈跟踪是什么?没有例外。。没有错误。。这就是我得到的一切。