Delete in EUSql
- Posted by sixs at ida.net Apr 19, 2003
- 418 views
This is a multi-part message in MIME format. ------=_NextPart_000_0066_01C305E2.C44A5760 charset="iso-8859-1" I use set_parameters to create a value to insert a record using Eusql = into EDB database. In another procedure I read the EDB using Eusql and display the data in = a List including the key value whic is not readable format. I then select the record by clicking on it, I get the index and use it = to select the record to be deleted. The record is not deleted. These are the way I create the record then = list the recod and find the record to delete I also want to use code to create a number for the KEYID value. ****add Record********** i =3D 1 --length( PEOPLE ) do setText(dbText, i) rtn_code =3D message_box("Show I", "remind for Win98", MB_ICONWARNING+MB_OK) set_parameter( "ARG0", i) set_parameter( "ARG1", hlname) set_parameter( "ARG2", hfname) set_parameter( "ARG3", haddress) set_parameter( "ARG4", hstreet) set_parameter( "ARG5", hcity) set_parameter( "ARG6", hstate) set_parameter( "ARG7", hzip) set_parameter( "ARG8", hphone) -- ok =3D run_query( sql ) --if atom(ok) then -- puts(1, get_sql_err( ok ) ) -- ? 1/0 -- end if=20 ok =3D run_sql( "INSERT INTO PEOPLE PEOPLE.KEYID, = PEOPLE.LNAME,PEOPLE.FNAME," & "PEOPLE.ADDRESS, PEOPLE.STREET," & "PEOPLE.CITY, PEOPLE.STATE, PEOPLE.ZIP, PEOPLE.PHONE " & "VALUES([ARG0], [ARG1],[ARG2], [ARG3],[ARG4],[ARG5],[ARG6], = [ARG7], [ARG8])") rtn_code =3D message_box(" added record", "remind for Win98", MB_ICONWARNING+MB_OK) loadList() *************Select list record**************** rocedure List1_onClick (integer self, integer event, sequence = params)--params is () sequence linex, liney, linet integer indx indx =3D getIndex(List1) linex =3D getItem(List1,indx) linet =3D linex gxkey =3D (linex[1]) setText(dbText, gxkey) rtn_code =3D message_box("List1 click line", "remind for Win98", MB_ICONWARNING+MB_OK) end procedure **** DElete Record******************** rocedure btnDel_onClick (integer self, integer event, sequence = params)--params is () integer junk, rec, f, key rtn_code =3D message_box("Start delete ", "remind for Win98", MB_ICONWARNING+MB_OK) setText(dbText, gxkey) rtn_code =3D message_box("Did dbyext loadlist ", "remind for Win98", MB_ICONWARNING+MB_OK) set_parameter( "ARG0", (gxkey)) ***************I have tried the set parameter value but had no delete of = record***************** ok =3D run_sql( "DELETE FROM PEOPLE WHERE PEOPLE.KEYID =3D 1") if atom(ok) then puts(1, get_sql_err( ok )) -- ? 1/0 end if rtn_code =3D message_box("Did sql ", "remind for Win98", MB_ICONWARNING+MB_OK) loadList() rtn_code =3D message_box("Did loadlist ", "remind for Win98", MB_ICONWARNING+MB_OK) end procedure ------=_NextPart_000_0066_01C305E2.C44A5760 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META http-equiv=3DContent-Type content=3D"text/html; = charset=3Diso-8859-1"> <META content=3D"MSHTML 6.00.2800.1106" name=3DGENERATOR> <STYLE></STYLE> </HEAD> <BODY style=3D"COLOR: #000000; FONT-FAMILY: " bgColor=3D#ffffff> <DIV><FONT face=3DArial size=3D2> I use set_parameters to create a = value to=20 insert a record using Eusql into EDB database.</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2>In another procedure I read the EDB = using Eusql and=20 display the data in a List including the key value whic is not readable=20 format.</FONT></DIV> <DIV><FONT face=3DArial size=3D2>I then select the record by clicking on = it, I=20 get the index and use it to select the record to be = deleted.</FONT></DIV> <DIV><FONT face=3DArial size=3D2>The record is not = deleted.</FONT> <FONT=20 face=3DArial size=3D2> These are the way I create the record then list = the recod and=20 find the record to delete</FONT></DIV> <DIV><FONT face=3DArial size=3D2>I also want to use code to = create a=20 number for the KEYID value.</FONT></DIV> <DIV><FONT face=3DArial size=3D2>****add Record**********</FONT></DIV> <DIV><FONT face=3DArial size=3D2>i =3D 1 --length( PEOPLE )=20 do<BR> setText(dbText, i)<BR>rtn_code =3D message_box("Show=20 I",<BR> "remind for Win98",=20 MB_ICONWARNING+MB_OK)</FONT></DIV> <DIV> </DIV> <DIV><FONT face=3DArial size=3D2> set_parameter( "ARG0",=20 i)<BR> set_parameter( "ARG1", = hlname)<BR> =20 set_parameter( "ARG2", hfname)<BR>set_parameter( "ARG3",=20 haddress)<BR>set_parameter( "ARG4", hstreet)<BR>set_parameter( "ARG5",=20 hcity)<BR>set_parameter( "ARG6", hstate)<BR>set_parameter( "ARG7",=20 hzip)<BR>set_parameter( "ARG8", hphone)</FONT></DIV> <DIV> </DIV> <DIV><FONT face=3DArial size=3D2> -- ok =3D run_query( sql=20 )<BR> --if atom(ok) then<BR> =20 -- puts(1, get_sql_err( ok ) = )<BR> =20 -- ? 1/0<BR> -- end if <BR> ok =3D = run_sql(=20 "INSERT INTO PEOPLE PEOPLE.KEYID, PEOPLE.LNAME,PEOPLE.FNAME,"=20 &<BR> "PEOPLE.ADDRESS, PEOPLE.STREET,"=20 &<BR> "PEOPLE.CITY, PEOPLE.STATE, PEOPLE.ZIP, = PEOPLE.PHONE "=20 &<BR> "VALUES([ARG0], [ARG1],[ARG2],=20 [ARG3],[ARG4],[ARG5],[ARG6], [ARG7], [ARG8])")<BR> =20 rtn_code =3D message_box(" added = record",<BR> =20 "remind for Win98", MB_ICONWARNING+MB_OK)<BR> =20 loadList()<BR>*************Select list = record****************</FONT></DIV> <DIV><FONT face=3DArial size=3D2>rocedure List1_onClick (integer self, = integer=20 event, sequence params)--params is ()<BR> sequence linex, liney,=20 linet<BR> integer indx<BR> indx =3D=20 getIndex(List1)<BR> linex =3D getItem(List1,indx)<BR>linet =3D=20 linex</FONT></DIV> <DIV> </DIV> <DIV><FONT face=3DArial size=3D2>gxkey =3D (linex[1])</FONT></DIV> <DIV> </DIV> <DIV><FONT face=3DArial size=3D2>setText(dbText, = gxkey)<BR> rtn_code =3D=20 message_box("List1 click line",<BR> "remind for = Win98",=20 MB_ICONWARNING+MB_OK)<BR>end procedure<BR>**** DElete=20 Record********************</FONT></DIV> <DIV><FONT face=3DArial size=3D2>rocedure btnDel_onClick (integer self, = integer=20 event, sequence params)--params is ()<BR> integer junk, rec, f,=20 key<BR> rtn_code =3D message_box("Start delete=20 ",<BR> "remind for Win98",=20 MB_ICONWARNING+MB_OK)<BR> setText(dbText, gxkey)</FONT></DIV> <DIV> </DIV> <DIV><FONT face=3DArial size=3D2>rtn_code =3D message_box("Did dbyext = loadlist=20 ",<BR> "remind for Win98",=20 MB_ICONWARNING+MB_OK)<BR> set_parameter( "ARG0", = (gxkey))</FONT></DIV> <DIV><FONT face=3DArial size=3D2>***************I have tried the set = parameter value=20 but had no delete of record*****************</FONT></DIV> <DIV><FONT face=3DArial size=3D2>ok =3D run_sql( "DELETE FROM PEOPLE = WHERE=20 PEOPLE.KEYID =3D 1")<BR>if atom(ok) then<BR> puts(1,=20 get_sql_err( ok ))<BR>-- ? 1/0<BR>end if</FONT></DIV> <DIV> </DIV> <DIV><FONT face=3DArial size=3D2>rtn_code =3D message_box("Did sql=20 ",<BR> "remind for Win98",=20 MB_ICONWARNING+MB_OK)<BR> loadList()<BR> = rtn_code =3D=20 message_box("Did loadlist ",<BR> "remind for = Win98",=20 ------=_NextPart_000_0066_01C305E2.C44A5760--