Chinaunix
标题:
关于游标的问题,大家帮忙看看程序有什么问题!
[打印本页]
作者:
jackwenghui
时间:
2007-08-21 10:46
标题:
关于游标的问题,大家帮忙看看程序有什么问题!
$include sqlca;
main()
{
$char DbNameLc[19];
char ErrMsg[512];
$long int num;
$char name[20+1];
$char address[20+1];
printf( "Enter name of database: " );
gets( DbNameLc );
$database $DbNameLc;
if( SQLCODE == 0 )
printf( "Database %s is now open.\n", DbNameLc );
else
{
rgetmsg((short)sqlca.sqlcode,ErrMsg,sizeof(ErrMsg));
printf( "Error in opening database: %d:%s\n", SQLCODE,ErrMsg);
}
$declare CustPtr scroll cursor for select * from test;
$open CustPtr;
$fetch first CusPtr into $num,$name,$address;
printf("=====================\n");
printf("The num is:%d\n",&num);
printf("=====================\n");
printf("The name is:%c\n",&name);
printf("=====================\n");
printf("The address is:%c\n",&address);
printf("======================\n");
$close database;
if(SQLCODE == 0)
printf("Database %s is now close.\n",DbNameLc);
else
{
rgetmsg((short)sqlca.sqlcode,ErrMsg,sizeof(ErrMsg));
printf( "Error in opening database: %d:%s\n", SQLCODE,ErrMsg);
}
exit( 0 );
}
无法显示数据库所列出的信息!
作者:
ivhb
时间:
2007-08-21 15:21
你要补习C语言了
输出部分,改成
printf
("=====================\n");
printf ("The num is:%ld\n", num);
printf ("=====================\n");
printf ("The name is:%s\n", name);
printf ("=====================\n");
printf ("The address is:%s\n", address);
printf ("======================\n");
复制代码
作者:
qzliang1120
时间:
2007-09-19 10:04
呵呵
欢迎光临 Chinaunix (http://bbs.chinaunix.net/)
Powered by Discuz! X3.2