SQL查询值赋值问题
lnHandle=SQLConnect(lcODBCName,lcDBUser,lcDBPasswd)**定义变量SQLTEMP="SELECT STUFF(STUFF((SELECT replace('"+alltrim(thisform.text11.value)+"','-','')),CHARINDEX(DQDM,(SELECT replace('"+alltrim(thisform.text11.value)+"','-','')),5),0,'-'),CHARINDEX(DQDM,(SELECT replace('"+alltrim(thisform.text11.value)+"','-','')),5)+LEN(DQDM)+1,0,'-') G_ZHH FROM gp_g_xxb WHERE replace('"+alltrim(thisform.text11.value)+"','-','')=G_ZHH"If lnHandle>0 &&连接成功 **查询数据) SQLExec(lnHandle,SQLTEMP,"TEXT11TMP") **赋查询值给数组 SELECT g_zhh FROM text11tmp INTO ARRAY text11t **更新数据 If SQLExec(lnHandle,"insert into vk_bouns values (newid(),'(?TEXT11t(1))','"+alltrim(thisform.text12.value)+"','"+alltrim(thisform.text13.value)+"','"+alltrim(thisform.text14.value)+"','"+alltrim(thisform.text15.value)+"')")>0 &&运行成功 Thisform.commandgroup1.comOK.Click Messagebox("新增成功",0,"提示") Else &&失败 &&出错处理 EndifElse &&连接失败 Messagebox("连接SQL SERVER失败",16,"BUFFER")Endif
**查询数据) SQLExec(lnHandle,SQLTEMP,"TEXT11TMP") **赋查询值给数组 SELECT g_zhh FROM text11tmp INTO ARRAY text11t
'(?TEXT11t(1))'
lnHandle=SQLConnect(lcODBCName,lcDBUser,lcDBPasswd)**定义变量SQLTEMP="SELECT STUFF(STUFF((SELECT replace('"+Alltrim(Thisform.text11.Value)+"','-','')),CHARINDEX(DQDM,(SELECT replace('"+Alltrim(Thisform.text11.Value)+"','-','')),5),0,'-'),CHARINDEX(DQDM,(SELECT replace('"+Alltrim(Thisform.text11.Value)+"','-','')),5)+LEN(DQDM)+1,0,'-') G_ZHH FROM gp_g_xxb WHERE replace('"+Alltrim(Thisform.text11.Value)+"','-','')=G_ZHH"If lnHandle>0 &&连接成功 **查询数据) SQLExec(lnHandle,SQLTEMP,"TEXT11TMP") **赋查询值给数组 Select g_zhh From text11tmp Into Array text11t **更新数据 lcf2=Alltrim(Thisform.text12.Value) lcf3=Alltrim(Thisform.text13.Value) lcf4=Alltrim(Thisform.text14.Value) lcf5=Alltrim(Thisform.text15.Value) If SQLExec(lnHandle,"insert into vk_bouns values (newid(),?TEXT11t(1),?lcf2,?lcf3,?lcf4,?lcf5)")>0 &&运行成功 *If SQLExec(lnHandle,"insert into vk_bouns values (?newid(),?TEXT11t(1),?lcf2,?lcf3,?lcf4,?lcf5)")>0 &&运行成功 Thisform.commandgroup1.comOK.Click Messagebox("新增成功",0,"提示") Else &&失败 &&出错处理 EndifElse &&连接失败 Messagebox("连接SQL SERVER失败",16,"BUFFER")Endif