بتاريخ: 13 ديسمبر 200520 سنة comment_54202 can any one help me with correcting the code or can any one give me another code for using it in the login form.this is my problem:-i had make a login form using in oracle 9i form builder >>>in this form i have three text boxes one for intering user name and the second one for entering the password and the third text box is not visible and it is used for counting the tries. In addition i have a three buttons , one is for login and the two others are not visible and they are a show main menu button and a exit button. For login button i had put a WHEN-BUTTON-PRESSED trigger in the login button and it must check if the user name and the password match what it is on the login table so it allow the user to see the show main menu button otherwise if the user name or the password are wrong and has been putted wrong for 3 times of trying then it will show the exit button.and this is a picture of the login form in the design view. http://www.al7loh.com/uploader/uploads/login.JPGand this is the code for theWHEN-BUTTON-PRESSED trigger on the login button._________declarealertNum number;dummy1 tbl_login.USER_NAME%type;dummy2 tbl_login.PASSWORD%type;beginselect tbl_login.USER_NAME into dummy1 from tbl_login where tbl_login.USER_NAME = :LOGIN.USER_NAME ;select tbl_login.PASSWORD into dummy2 from tbl_login where tbl_login.PASSWORD = :LOGIN.PASSWORD ;if :LOGIN.TRIES<3 thenif sql% foundthenset_item_property('LOGIN.SHOW_MENU', visible, property_true);set_item_property('LOGIN.SHOW_MENU', enabled, property_true);elsemessage ('Invalid password....try again');:LOGIN.TRIES := :LOGIN.TRIES+1;:LOGIN.USER_NAME := null;:LOGIN.PASSWORD := null;end if;elsemessage ('Exceeded Number of tries..press exit button');set_item_property('LOGIN.EXIT', visible, property_true);set_item_property('LOGIN.EXIT', enabled, property_true);end if;end;___________can any one help me correcting the code of the WHEN-BUTTON-PRESSED trigger on the login form or can any one give me another code for using it in the login form.i hope to get some help from the experts>>> تقديم بلاغ
بتاريخ: 13 ديسمبر 200520 سنة comment_54207 اخي الكريم بالبداية يوجد بالكود عندك 3 أخطاء :1- يوجد فراغ بين sql% found و الصحيح هو : sql%found 2- التعبير : if :LOGIN.TRIES<3 then ليس له معني لسبب أن قيمة :LOGIN.TRIES هي بالبداية null لذلك لاتقارن قيمة null مع أي شيء لذلك الصحيح هو كتابة if nvl(:LOGIN.TRIES,0)<3 then 3- نفس الأمر بالنسبة لـ :LOGIN.TRIES := :LOGIN.TRIES+1; الصحيح هو كتابة LOGIN.TRIES := nvl(:LOGIN.TRIES,0)+1;بالإضافة أنه لديك حقل بجدول اسمه password أفضل تغيير اسمه لـ password1 مثلا أعتقد أنا كلمة محجوزة لكن الغريب أنه تم قبولها بانشاء الجدول .. !! المهم جرب صحح هذه الأمور إذا مامشي الحال خبرنا لأبعتلك كود صحيح غير الكود الذي كتبته لتنفيذ هذه العملية .وخبرنا شو بصير معك على كل الأحوال . تقديم بلاغ
بتاريخ: 13 ديسمبر 200520 سنة comment_54210 First you are inneed for a program unit, preferd stored in the DB, to check on the user_name and the password.consider the following:- -the user name should be unique.-the user will try for 3 times.so let us create a package which will handel what we need:CREATE OR REPLACE PACKAGE user_appIS FUNCTION allowed (user_name_in IN <user_name>%type ,pass_word_in IN <pass_word%type>) RETURN BOOLEAN;END user_app;/show error;CREATE OR REPLACE PACKAGE BODY user_appIS FUNCTION allowed (user_name_in IN <user_name>%type ,pass_word_in IN <pass_word%type>) RETURN BOOLEAN IS retval BOOLEAN := false; exi INTEGER ;BEGIN SELECT 1 INTO exi FROM <log_in_tab> WHERE upper(user_name) = upper (user_name_in) AND upper(pass_word) = upper(pass_word_in); IF exi = 1 THEN retval := TRUE; END IF;RETURN retval;EXCEPTION WHEN no_data_found THEN RETURN FALSE;END allowed;END user_app;/show error;Now we are redy to use our function : to insure the log in information is correct in the trigger we will write:- IF user_app.allowed(:user_name,:pass_word) THEN-- DO ANY THING ELSIF NOT user_app.allowed(:user_name,:pass_word) THEN :GLOBAL.tries := :GLOBAL.tries + 1; IF :GLOBAL.tries = 3 THEN-- DO ANY THING END IF; END IF; BY THE WAY YOU MUST IN THE PRE FORM TRIGGER DECLARE THE GLOBAL VARIABLE LIKE THIS::GLOBAL.tries:= 1;i hop it work.with best wishes. تقديم بلاغ
بتاريخ: 14 ديسمبر 200520 سنة كاتب الموضوع comment_54315 اخي الكريم بالبداية يوجد بالكود عندك 3 أخطاء :54207[/snapback] still the code does not workplease help me fixing it تقديم بلاغ
بتاريخ: 15 ديسمبر 200520 سنة كاتب الموضوع comment_54350 أرجو المساعدة من الاخوة باسرع وقت ممكنthe code does not do these steps___________________elsemessage ('Invalid password....try again');:LOGIN.TRIES := :LOGIN.TRIES+1;:LOGIN.USER_NAME := null;:LOGIN.PASSWORD := null;end if;elsemessage ('Exceeded Number of tries..press exit button');set_item_property('LOGIN.EXIT', visible, property_true);set_item_property('LOGIN.EXIT', enabled, property_true);end if;end;_____________can u tell me ur is the problem with my codeplease!!! تقديم بلاغ
بتاريخ: 15 ديسمبر 200520 سنة كاتب الموضوع comment_54418 أرجو المساعدة من الاخوة باسرع وقت ممكنthe code does not do these steps___________________elsemessage ('Invalid password....try again');:LOGIN.TRIES := :LOGIN.TRIES+1;:LOGIN.USER_NAME := null;:LOGIN.PASSWORD := null;end if;elsemessage ('Exceeded Number of tries..press exit button');set_item_property('LOGIN.EXIT', visible, property_true);set_item_property('LOGIN.EXIT', enabled, property_true);end if;end;_____________can u tell me ur is the problem with my codeplease!!!54350[/snapback] ????????ارجو المساعدة لو سمحتم يا خبراء الاوراكل ................؟!؟!!؟؟!؟! تقديم بلاغ
بتاريخ: 17 ديسمبر 200520 سنة كاتب الموضوع comment_54536 وين الجماعة ....؟؟؟؟وين مستخدمي أوراكل العرب....؟؟؟ أرجوووووكم ساعدوني بالكود......!!!!؟!؟!؟!؟! تقديم بلاغ
بتاريخ: 18 ديسمبر 200520 سنة كاتب الموضوع comment_54648 وين الجماعة ....؟؟؟؟وين مستخدمي أوراكل العرب....؟؟؟ أرجوووووكم ساعدوني بالكود......!!!!؟!؟!؟!؟! الظاهر لا حياة لمن تنادي... تقديم بلاغ
بتاريخ: 3 أكتوبر 200916 سنة comment_171420 declarealertNum number;dummy1 tbl_login.USER_NAME%type;dummy2 tbl_login.PASSWORD%type;beginselect tbl_login.USER_NAME into dummy1 from tbl_login where tbl_login.USER_NAME = :LOGIN.USER_NAME ;select tbl_login.PASSWORD into dummy2 from tbl_login where tbl_login.PASSWORD = :LOGIN.PASSWORD ;if :LOGIN.TRIES<3 thenif sql%foundthenset_item_property('LOGIN.SHOW_MENU', visible, property_true);set_item_property('LOGIN.SHOW_MENU', enabled, property_true);elsifmessage ('Invalid password....try again');:LOGIN.TRIES := :LOGIN.TRIES+1;:LOGIN.USER_NAME := null;:LOGIN.PASSWORD := null;elsifmessage ('Exceeded Number of tries..press exit button');set_item_property('LOGIN.EXIT', visible, property_true);set_item_property('LOGIN.EXIT', enabled, property_true);end if;end;-----------------------الخطا فى اف واند اف جرب وقولى تقديم بلاغ
انضم إلى المناقشة
يمكنك المشاركة الآن والتسجيل لاحقاً. إذا كان لديك حساب, سجل دخولك الآن لتقوم بالمشاركة من خلال حسابك.