在c ++中,我有一个名为"Student.h"的文件
class LinkedList {
private:
class Student {
public:
int stId;
char stName [20];
char stMajor[20];
double stAverage;
Student * next;
Student() {
next = 0;
}
Student(int stId, char stName [20], char stMajor[20], double stAverage) {
this.stId = stId;
strcopy(this.stName, stName); // there is error here !
strcopy(this.stMajor, stMajor);
this.stAverage = stAverage;
}
Run Code Online (Sandbox Code Playgroud)
我该怎么办 ?!
我有一个空指针异常
ResultSet rs = aStatement.executeQuery(Query); // it can't be executed
Run Code Online (Sandbox Code Playgroud)
我的代码是这样的:
public static boolean testLogin(String user, String password) throws SQLException {
String Query = "select * from TBL_Users where userName = '" + user + "' and passWord = '" + password + "' ";
ResultSet rs = aStatement.executeQuery(Query);
while (rs.next()) {
info.Id = rs.getInt("ID");
info.userName = rs.getString("userName");
info.Name = rs.getString("User_Name");
info.Password = rs.getString("passWord");
info.isAdmin = rs.getBoolean("Admin");
return true;
}
return false;
}
Run Code Online (Sandbox Code Playgroud)
}