السلام عليكم و رحمة الله و بركاته
الموضوع باختصار شديد
اريد عمل نظام دخول يتكون من اسم مستخدم و كلمة مرور
النظام عندي شغال ميه ميه الحمد لله و مربوط بقاعدة بيانات باستخدام odbc وكلو تمام
ولكن عملية التحقق من اسم المستخدم و كلمة المرور لم تنجح معي وانا على هذا الحال منذ اكثر من اسبوعين
و هذه اول مره اشارك في منتدى وارجو ان استفيد من خبراتكم
وهنا سأضع الجزء الذي اريد ان تساعدوني بفكرتكم عن حل هذه المشكلة
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection conn = DriverManager.getConnection("jdbc:odbc:mr","","");
Statement st = conn.createStatement();
ResultSet rec = st.executeQuery("SELECT MChatID, Password FROM m");
while (rec.next()) {
String x = login.getText();
String y = pwd.getText();
if (x.equals( rec.getString("MChatID"))) {
if (y.equals( rec.getString("Password")))
{
c1 = new client1(this);
//System.out.println("Logged in!");
}
else
{
login.setText("Invalid Login");
//System.out.println("Password did not match username!");
}
}
else {
login.setText("Username did not match the database");
}
}
st.close();
}
catch(SQLException d) {
System.out.println(e.toString());
} catch(ClassNotFoundException f) {
System.out.println(e.toString());
}
