main()
{
exec sql include sqlca
exec sql begin declare section
char prname[20];
char productno[8];exec sql end declare sectionprintf("Input producno:");
scanf("%s",&producno);exec sql select prname
from product
where productno=:productno
into :prname;printf("Productname: %s\n",prname);exit();} 注意sql语句中调用c的变量前要加:
用exec sql来表示将执行sql语句
{
exec sql include sqlca
exec sql begin declare section
char prname[20];
char productno[8];exec sql end declare sectionprintf("Input producno:");
scanf("%s",&producno);exec sql select prname
from product
where productno=:productno
into :prname;printf("Productname: %s\n",prname);exit();} 注意sql语句中调用c的变量前要加:
用exec sql来表示将执行sql语句
以上例程可能不行.