פורסם 2011 בינואר 414 שנים היי, אני מנסה ליצור סוג של התחברות לאתר, אבל לא משנה איזה נתונים אני מכניס בשדות הטקסט, אותו דף מגיע לי, גם אם הנתונים נמצאים בטבלה, או גם אם לא..הינה הקוד:זה הקוד של שליפת הנתונים מהטבלה:public class DBAccounts{ public DBAccounts() { } public static DBAccountsDataContext DbAccountsConnect =new DBAccountsDataContext(); public static Boolean cheakUsername (String usernameCheak, String passwordCheak) { var result= from p in DbAccountsConnect.tbl_Accounts where p.userName==usernameCheak && p.password==passwordCheak select p; if (result!=null) return true; else return false; }}וזהו הקוד של הטופס: protected void Button1_Click(object sender, EventArgs e) { Boolean exist = DBAccounts.cheakUsername(TextBox1.Text, TextBox2.Text); if (exist==true) { Response.Redirect("home.aspx"); } else Response.Redirect("error.aspx"); }
ארכיון
דיון זה הועבר לארכיון ולא ניתן להוסיף בו תגובות חדשות.