藍森林首頁 | 返回主頁 | 本站地圖 | 站內搜索 | 聯繫信箱 |
 您目前的位置:首頁 > 自由軟件 > 技術交流 > 應用編程


    

藍森林 http://www.lslnet.com 2006年6月6日 10:18


在proc裡面實現界面登陸

我在*.pc文件裡面寫了一個好函數,是關於界面登陸的。函數如下:
int get_password(int user_num1)
{
EXEC SQL BEGIN DECLARE  SECTION;
int user_password_out;
int sum;
EXEC SQL declare password_cursor for
            select count(*),user_password from user_table  
           where  user_num= :user_num1;
EXEC SQL open password_cursor;
EXEC SQL fetch password_cursor into :sum,:user_password_out;
/*問題就出在這裡,返回的user_password_out總是很大,或者就是一個固定的值,不是表裡面的值,sum與user_num1的值是正確的。也就是我要想從表裡面返回一個值,並且是把值放在宿主變量user_password_out裡面的時候,可是宿主變量(user_password_out)顯示的值是不正確的,這是怎麼回事呀?*/
printf("The number is %d,the user num is %d,the user password is %d\n",sum,user_num1,user_password_out);
  /* 如果用戶存在就返回用戶口令 */
if (sum==1)
   return(user_password_out);
/*如果用戶不存在就打印無此用戶*/
else printf("not the user");

EXEC SQL close password_cursor;
}
請大家幫幫忙,我總是在線QQ:27667250  MSN:cassiesong@hotmail.com



Copyright © 1999-2000 LSLNET.COM. All rights reserved. 藍森林網站 版權所有。 E-mail : webmaster@lslnet.com