1. EDS Database Problem
Hello All,
I have a EDS database and I created a simple procedure to delete a selecte=
d
record from the database. But there seems to be a problem with deleting the=
correct record from the database. The procedure is finding the correct item=
and returning the correct record number, but when=20
db_delete_record(findrecord) is called the last record in the database is=
deleted, no matter what record is selected. Anyone have a clue what I am=
doing wrong? I am using the following code:
procedure Test()
integer findrecord
sequence selecteditem,item
selecteditem = getLVSelected(MyList)
item = getLVItemText(MyList, selecteditem[1],1)
if db_select_table("Table1") != DB_OK then
end if
findrecord = db_find_key(item)
db_delete_record(findrecord)
end procedure
2. Re: EDS Database Problem
EU Coder wrote:
>
> Hello All,
>
> I have a EDS database and I created a simple procedure to delete a selecte=
> d
> record from the database. But there seems to be a problem with deleting the=
>
> correct record from the database. The procedure is finding the correct item=
>
> and returning the correct record number, but when=20
> db_delete_record(findrecord) is called the last record in the database is=
>
> deleted, no matter what record is selected. Anyone have a clue what I am=
>
> doing wrong? I am using the following code:
>
> procedure Test()
> integer findrecord
> sequence selecteditem,item
>
> selecteditem = getLVSelected(MyList)
>
> item = getLVItemText(MyList, selecteditem[1],1)
> if db_select_table("Table1") != DB_OK then
> end if
> findrecord = db_find_key(item)
> db_delete_record(findrecord)
> end procedure
>
>
i have not finished my own program, but looking at another program from the
archives, the record number should be an atom , not an integer
but you would think an error message would be generated?
it probably points to last record set because it was the last record read in.
rudy
3. Re: EDS Database Problem
Hi Rudy,
Either an integer or atom should work, but either isn't working and I have=
no clue why.
>From: rudy toews <guest at RapidEuphoria.com>
>Reply-To: EUforum at topica.com
>To: EUforum at topica.com
>Subject: Re: EDS Database Problem
>Date: Sat, 11 Jun 2005 12:40:01 -0700
>
>
>posted by: rudy toews <rltoews at ilos.net>
>
>EU Coder wrote:
> >
> > Hello All,
> >
> > I have a EDS database and I created a simple procedure to delete a
>selecte=
> > d
> > record from the database. But there seems to be a problem with deleting=
>the=
> >
> > correct record from the database. The procedure is finding the correct=
>item=
> >
> > and returning the correct record number, but when=20
> > db_delete_record(findrecord) is called the last record in the database=
>is=
> >
> > deleted, no matter what record is selected. Anyone have a clue what I=
>am=
> >
> > doing wrong? I am using the following code:
> >
> > procedure Test()
> > integer findrecord
> > sequence selecteditem,item
> >
> > selecteditem = getLVSelected(MyList)
> >
> > item = getLVItemText(MyList, selecteditem[1],1)
> > if db_select_table("Table1") != DB_OK then
> > end if
> > findrecord = db_find_key(item)
> > db_delete_record(findrecord)
> > end procedure
> >
> >
>i have not finished my own program, but looking at another program from th=
e
>archives, the record number should be an atom , not an integer
>but you would think an error message would be generated?
>it probably points to last record set because it was the last record read=
>in.
>
>rudy
>
>
>
>
4. Re: EDS Database Problem
- Posted by Greg Haberek <ghaberek at gmail.com>
Jun 11, 2005
-
Last edited Jun 12, 2005
> procedure Test()
> integer findrecord
> sequence selecteditem,item
>
> selecteditem = getLVSelected(MyList)
>
> item = getLVItemText(MyList, selecteditem[1],1)
> if db_select_table("Table1") != DB_OK then
> end if
> findrecord = db_find_key(item)
> db_delete_record(findrecord)
> end procedure
If you're just grabbing the first column of text, use
getLVSelectedText() instead of getLVSelected() and getLVItemText().
That should help iron out some wrinkles. Also, a little more fact
checking always helps spot a few bugs. I re-worked your routine, give
it a shot and see if it works.
procedure Test()
sequence selected
integer rec
selected = getLVSelectedText( MyList )
if length(selected) = 0 then
-- no items selected
return
end if
if db_select_table("Table1") != DB_OK then
-- table not available
return
end if
-- walk 'up' the items, deleting each one
for i = length(selected) to 1 by -1 do
rec = db_find_key( selected[i] )
if rec > 0 then
-- record found, delete it
db_delete_record( rec )
end if
end for
end procedure
5. Re: EDS Database Problem
- Posted by "EU Coder" <eucoder at hotmail.com>
Jun 11, 2005
-
Last edited Jun 12, 2005
Nope that didnt work. I am starting to think there is another factor in all=
of this. I am going to look over my code and try and track it down.
Thanks...
>From: Greg Haberek <ghaberek at gmail.com>
>Reply-To: EUforum at topica.com
>To: EUforum at topica.com
>Subject: Re: EDS Database Problem
>Date: Sat, 11 Jun 2005 16:35:40 -0400
>
>
> > procedure Test()
> > integer findrecord
> > sequence selecteditem,item
> >
> > selecteditem = getLVSelected(MyList)
> >
> > item = getLVItemText(MyList, selecteditem[1],1)
> > if db_select_table("Table1") != DB_OK then
> > end if
> > findrecord = db_find_key(item)
> > db_delete_record(findrecord)
> > end procedure
>
>If you're just grabbing the first column of text, use
>getLVSelectedText() instead of getLVSelected() and getLVItemText().
>That should help iron out some wrinkles. Also, a little more fact
>checking always helps spot a few bugs. I re-worked your routine, give
>it a shot and see if it works.
>
>}}}
<eucode>
>procedure Test()
>
> sequence selected
> integer rec
>
> selected = getLVSelectedText( MyList )
> if length(selected) = 0 then
> -- no items selected
> return
> end if
>
> if db_select_table("Table1") != DB_OK then
> -- table not available
> return
> end if
>
> -- walk 'up' the items, deleting each one
> for i = length(selected) to 1 by -1 do
> rec = db_find_key( selected[i] )
> if rec > 0 then
> -- record found, delete it
> db_delete_record( rec )
> end if
> end for
>
>end procedure
></eucode>
{{{
>
Security. http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963
6. Re: EDS Database Problem
- Posted by "EU Coder" <eucoder at hotmail.com>
Jun 11, 2005
-
Last edited Jun 12, 2005
Ok I found the problem and it is a very odd bug. The problem has nothing to=
do with the procedure itself, but it seems the Active X SkinCrafter wrapper=
I am using is conflicting with something in EU. I have no idea what it is,=
but when I remove the wrapper it works fine, but as soon as I enable it, th=
e
procedure I posted does not work. What is confusing me is the fact the
wrapper should have nothing to do with the database. The SkinCrafter lib is=
used for skinning the application. Why would it conflict with EDS?
>From: EU Coder <eucoder at hotmail.com>
>Reply-To: EUforum at topica.com
>To: EUforum at topica.com
>Subject: Re: EDS Database Problem
>Date: Sat, 11 Jun 2005 16:52:31 -0400
>
>
>Nope that didnt work. I am starting to think there is another factor in=
>all=
>
>of this. I am going to look over my code and try and track it down.
>
>Thanks...
>
>>From: Greg Haberek <ghaberek at gmail.com>
>>Reply-To: EUforum at topica.com
>>To: EUforum at topica.com
>>Subject: Re: EDS Database Problem
>>Date: Sat, 11 Jun 2005 16:35:40 -0400
>>
>>
>> > procedure Test()
>> > integer findrecord
>> > sequence selecteditem,item
>> >
>> > selecteditem = getLVSelected(MyList)
>> >
>> > item = getLVItemText(MyList, selecteditem[1],1)
>> > if db_select_table("Table1") != DB_OK then
>> > end if
>> > findrecord = db_find_key(item)
>> > db_delete_record(findrecord)
>> > end procedure
>>
>>If you're just grabbing the first column of text, use
>>getLVSelectedText() instead of getLVSelected() and getLVItemText().
>>That should help iron out some wrinkles. Also, a little more fact
>>checking always helps spot a few bugs. I re-worked your routine, give
>>it a shot and see if it works.
>>
>>}}}
<eucode>
>>procedure Test()
>>
>> sequence selected
>> integer rec
>>
>> selected = getLVSelectedText( MyList )
>> if length(selected) = 0 then
>> -- no items selected
>> return
>> end if
>>
>> if db_select_table("Table1") != DB_OK then
>> -- table not available
>> return
>> end if
>>
>> -- walk 'up' the items, deleting each one
>> for i = length(selected) to 1 by -1 do
>> rec = db_find_key( selected[i] )
>> if rec > 0 then
>> -- record found, delete it
>> db_delete_record( rec )
>> end if
>> end for
>>
>>end procedure
>></eucode>
{{{
>>
>
>
>Security. http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963
>
>
>
>
7. Re: EDS Database Problem
EU Coder wrote:
>
> Ok I found the problem and it is a very odd bug. The problem has nothing to=
>
> do with the procedure itself, but it seems the Active X SkinCrafter wrapper=
>
> I am using is conflicting with something in EU. I have no idea what it is,=
>
> but when I remove the wrapper it works fine, but as soon as I enable it, th=
> e
> procedure I posted does not work. What is confusing me is the fact the
> wrapper should have nothing to do with the database. The SkinCrafter lib is=
>
> used for skinning the application. Why would it conflict with EDS?
>
>
> >From: EU Coder <eucoder at hotmail.com>
> >Reply-To: EUforum at topica.com
> >To: EUforum at topica.com
> >Subject: Re: EDS Database Problem
> >Date: Sat, 11 Jun 2005 16:52:31 -0400
> >
> >
> >Nope that didnt work. I am starting to think there is another factor in=
>
> >all=
> >
> >of this. I am going to look over my code and try and track it down.
> >
> >Thanks...
> >
> >>From: Greg Haberek <ghaberek at gmail.com>
> >>Reply-To: EUforum at topica.com
> >>To: EUforum at topica.com
> >>Subject: Re: EDS Database Problem
> >>Date: Sat, 11 Jun 2005 16:35:40 -0400
> >>
> >>
> >> > procedure Test()
> >> > integer findrecord
> >> > sequence selecteditem,item
> >> >
> >> > selecteditem = getLVSelected(MyList)
> >> >
> >> > item = getLVItemText(MyList, selecteditem[1],1)
> >> > if db_select_table("Table1") != DB_OK then
> >> > end if
> >> > findrecord = db_find_key(item)
> >> > db_delete_record(findrecord)
> >> > end procedure
> >>
> >>If you're just grabbing the first column of text, use
> >>getLVSelectedText() instead of getLVSelected() and getLVItemText().
> >>That should help iron out some wrinkles. Also, a little more fact
> >>checking always helps spot a few bugs. I re-worked your routine, give
> >>it a shot and see if it works.
> >>
> >>}}}
<eucode>
> >>procedure Test()
> >>
> >> sequence selected
> >> integer rec
> >>
> >> selected = getLVSelectedText( MyList )
> >> if length(selected) = 0 then
> >> -- no items selected
> >> return
> >> end if
> >>
> >> if db_select_table("Table1") != DB_OK then
> >> -- table not available
> >> return
> >> end if
> >>
> >> -- walk 'up' the items, deleting each one
> >> for i = length(selected) to 1 by -1 do
> >> rec = db_find_key( selected[i] )
> >> if rec > 0 then
> >> -- record found, delete it
> >> db_delete_record( rec )
> >> end if
> >> end for
> >>
> >>end procedure
> <font color="#330033">>></eucode>
{{{
</font>
> >>
> >
> >Security. <a
> >href="http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963">http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963</a>
> >
> >
Are you sure it's not the getLVSelectedText() that is causing problems?
Regards, Alexander Toresson
8. Re: EDS Database Problem
- Posted by "EU Coder" <eucoder at hotmail.com>
Jun 11, 2005
-
Last edited Jun 12, 2005
>Are you sure it's not the getLVSelectedText() that is causing problems?
>
>Regards, Alexander Toresson
>
Yes I am very sure. Once I disable the ActiveX lib everything works fine.
9. Re: EDS Database Problem
EU Coder wrote:
>
> Hello All,
>
> I have a EDS database and I created a simple procedure to delete a selected
> record from the database. But there seems to be a problem with deleting the
> correct record from the database. The procedure is finding the correct item
> and returning the correct record number, but when
> db_delete_record(findrecord) is called the last record in the database is
> deleted, no matter what record is selected. Anyone have a clue what I am
> doing wrong?
I think that the file buffer isn't getting flushed for some reason when
the program exits. Perhaps the activex is prematurely shutting things
down, and Euphoria doesn't get a chance to flush the buffers. There seem
to be several ways to solve this. One is to remember to call db_close()
when you're done. You should do this in your onClose procedure as well
as a crash routine, just in case. Alternatively, you could add calls to
flush at the end of the various db_XXX() routines that write something
to the database. I wouldn't recommend this, because it could harm
performance if you do something that strings together many database calls.
Matt Lewis