Update表时字段名是变量,怎么写SQL语句
1个回答
展开全部
string ls_sql
string ls_data //假设要获取数据的列的类型为char,其他类型则定义相应的变量类型
ls_sql = "select " + ls_updatefield + " from " + ls_tablename + " where aac001 = " + string(bh_read)
declare lc dynamic cursor for sqlsa;
prepare sqlsa from :ls_sql using sqlca;
open dynamic lc;
if sqlca.sqlcode = -1 then
messagebox('', '出错了')
return
end if
fetch lc into :ls_data; //获取数据
if sqlca.sqlcode = -1 then
messagebox('', '出错了')
return
end if
close lc;
string ls_data //假设要获取数据的列的类型为char,其他类型则定义相应的变量类型
ls_sql = "select " + ls_updatefield + " from " + ls_tablename + " where aac001 = " + string(bh_read)
declare lc dynamic cursor for sqlsa;
prepare sqlsa from :ls_sql using sqlca;
open dynamic lc;
if sqlca.sqlcode = -1 then
messagebox('', '出错了')
return
end if
fetch lc into :ls_data; //获取数据
if sqlca.sqlcode = -1 then
messagebox('', '出错了')
return
end if
close lc;
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询