谁能指出我的代码有什么问题?第一个函数与第二个函数位于不同的 aspx 文件中。
    protected void btnManageUsersAddUser_Click(object sender, EventArgs e)
{
    if (clsDataLayer.SaveUser(Server.MapPath("PayrollSystem_DB.mdb"), txtManageUsersName.Text, txtManageUsersPassword.Text, ddlSecurityLevel.SelectedValue))
    {
        lblAddUserMsg.Text = "The user was successfully added";
        grdManagePersonnel.DataBind();
    }
    else
    {
        lblAddUserMsg.Text = "The user was not successfully added";
    }
以下函数最初是“bool”而不是“void”,但由于并非所有返回值的错误,我的教授告诉我将其更改为“void”。
    public static void SaveUser(string Database, string UserName, string UserPassword, string SecurityLevel)
{
    bool recordSaved;
    try
    {
        // Create connection
        OleDbConnection conn = new OleDbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0;" +
                                                   "Data Source=" + Database);
        conn.Open();
        OleDbCommand command = conn.CreateCommand();
        string strSQL;
        // Insert to tblUserLogin
        strSQL = "Insert into tblUserLogin " +
                 "(UserName, UserPassword, SecurityLevel) values ('" +
                 UserName + "', '" + UserPassword + "', '" + SecurityLevel + "')";
        // Process data
        command.CommandType = CommandType.Text;
        command.CommandText = strSQL;
        // Add your comments here
        command.ExecuteNonQuery();
        // Closes the transaction when true
        conn.Close();
        recordSaved = true;
    }
            catch (Exception ex)
    {
    }
}