我遇到了我的代碼問題,不知道最新的問題。任何人都可以建議嗎?DataAdapter.Fill()的FROM子句中的語法錯誤
整個程序是用於生物識別程序。這只是登錄用戶控制器。我怎麼解決這個問題?在FROM子句中的語法錯誤:
我在該行面臨這樣的問題:
dbAdapter.Fill(uds);
指出:
OleDbException是未處理的。
我的代碼如下所示:
這是我的登錄頁面的形式:用以下代碼。每當我點擊登錄,錯誤出現。我的代碼有什麼問題?
我的代碼如下所示:LOGIN PAGE FORM
namespace Privacy_Biometric_Defender
{
public partial class Login : Form
{
//A kind of gobal var to share in project
public static string fixedUName;
public Login()
{
InitializeComponent();
}
private void LoginClearButton_Click(object sender, EventArgs e)
{
LoginUsernameTextBox.Clear();
LoginPasswordTextBox.Clear();
LoginUsernameTextBox.Focus();
}
private void Login_Load(object sender, EventArgs e)
{
LoginUsernameTextBox.Focus();
}
private void LoginButton_Click(object sender, EventArgs e)
{
string userName = this.LoginUsernameTextBox.Text;
MessageBox.Show("Codes Stops Here");
UserController cont1 = new UserController();
User SearchUserName = new User();
// Passing textbox input to Controller
fixedUName = LoginUsernameTextBox.Text;
SearchUserName = cont1.SearchUserName(userName);
string passwd = this.LoginPasswordTextBox.Text;
UserController cont2 = new UserController();
User SearchPassword = new User();
// Passing textbox input to Controller
SearchPassword = cont2.SearchPassword(UserController.GetSHA512(passwd));
// Collect information from Controller
string checkUnameExist = UserController.uNameExist;
string checkPasswordExist = UserController.passwordExist;
string checkRoleExist = UserController.roleExist;
if (checkPasswordExist == "Exists" && checkUnameExist == "Exists")
{
MessageBox.Show("Login Successfully");
}
else
{
MessageBox.Show("Login Unsuccessfully!");
}
}
private void LoginUsernameTextBox_TextChanged(object sender, EventArgs e)
{
}
}
}
嘗試用'string sqlStatement =「從[用戶]中選擇*;' – Marco
謝謝,問題解決了。 – Derek