小编soa*_*yek的帖子

如何在c ++中使用strcopy

在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)

我该怎么办 ?!

c++ copy char

1
推荐指数
1
解决办法
463
查看次数

使用executeQuery时出现NullPointerException

我有一个空指针异常

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)

}

java jdbc resultset

0
推荐指数
2
解决办法
950
查看次数

标签 统计

c++ ×1

char ×1

copy ×1

java ×1

jdbc ×1

resultset ×1