pro*c/c++在插入数据后查询就遇到了问题,请大家帮帮忙
问题描述:在向数据库插入数据后(多条)然后查询数据,只可以显示第一条数据的完整信息,之后查询的信息除了name字段跟查询要求一样,接下来的字段就是第一次查询结果里面的字段。这个问题很难解释出来到底是为什么。难道是哪里写错了吗?代码比较长,贴查询函数在这里让大家指点一下。
数据类型说明:
char name[11];
char age[5];
char sex[3];
char address[50];
char mobile_phone[15];
char home_phone[15];
char e_mail[50];
char QQ[15];
char relation[50];
查询函数:
void select()
{
char t6= 'y ';
while(t6== 'y '|| t6== 'Y ')
{
cout < < "请输入要查询的记录的主码即姓名: " < <endl;
cin> > name;
EXEC SQL SELECT name, age, sex, address, mobile_phone, home_phone, e_mail, QQ, relation
INTO :name, :age:ageid, :sex:sexid, :address:addressid, :mobile_phone:mobile_phoneid, :home_phone:home_phoneid, :e_mail:e_mailid, :QQ:QQid, :relation:relationid
FROM COMMUNICATION
WHERE name=:name;
cout < < "查询结果如下: " < <endl;
cout < < "姓名: " < <name < <endl;
cout < < "年龄: " < <age < <endl;
cout < < "性别: " < <sex < <endl;
cout < < "地址: " < <address < <endl;
cout < < "手机: " < <mobile_phone < <endl;
cout < < "住宅电话: " < <home_phone < <endl;
cout < < "邮箱: " < <e_mail < <endl;
cout < < "QQ: " < <QQ < <endl;
cout < < "关系: " < <relation < <endl;
&n