Append Blank question

Append Blank question

Postby cdmmaui » Mon Oct 27, 2008 8:46 pm

I have a client with a large volume of new records daily. We are starting to have problems where a newly appended record is disappearing. What is the best way to handle append blank in a network environment. Currently, we have been using the sample below without a problem, but my client may have many instances where users are requesting APPEND BLANK at the same time.

SELECT tools
APPEND BLANK

Thank you in advance for your assistance.
*~*~*~*~*~*~*~*~*~*
Darrell Ortiz
CDM Software Solutions, Inc.
https://www.cdmsoft.com
User avatar
cdmmaui
 
Posts: 689
Joined: Fri Oct 28, 2005 9:53 am
Location: Houston ∙ Chicago ∙ Los Angeles ∙ Miami ∙ London ∙ Hong Kong

Postby Rick Lipkin » Mon Oct 27, 2008 9:09 pm

cdmmaui

There are two things you can do :

1) dbCommit()
2) GoTo recno()

dbCommit is supposed to do a 'hard disk' write .. however it is un-acceptibly slow if you are appending lots of records in a loop.. If you are just adding one record at a time dbCommit is your answer. If you are appending lots of records in a loop .. I use GoTo Recno() after you append the last field .. then at the end of the loop .. a dbCommit()

Rick Lipkin
User avatar
Rick Lipkin
 
Posts: 2665
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Postby cdmmaui » Mon Oct 27, 2008 9:14 pm

Hi Rick,

Thank You
*~*~*~*~*~*~*~*~*~*
Darrell Ortiz
CDM Software Solutions, Inc.
https://www.cdmsoft.com
User avatar
cdmmaui
 
Posts: 689
Joined: Fri Oct 28, 2005 9:53 am
Location: Houston ∙ Chicago ∙ Los Angeles ∙ Miami ∙ London ∙ Hong Kong

Postby Detlef Hoefner » Tue Oct 28, 2008 9:20 am

cdmmaui,

in a network environment it is dangerous not to check for neterr().
Here a module i use for append in networks.

example:

Code: Select all  Expand view
#define WAIT_SECONDS 2

   if lNetAddRec( "tools" )
      ? "New record was appended."
   else
      ? "Network error! No record appended."
   endif


/////////////////////////////
FUNCTION lNetAddRec( cAlias )
/////////////////////////////


   do while .t.
      if lAddRec( WAIT_SECONDS, cAlias )
         RETURN .t.
      endif

      if alert ( "Could not append a new record.;", { "Try again", "Cancel" } ) != 1
         RETURN .f.
      endif
   enddo
RETURN .f.

////////////////////////////////////
FUNCTION lAddRec( nSeconds, cAlias )
////////////////////////////////////


     do while nSeconds > 0
        ( cAlias )->( dbAppend() )
   
        if !neterr()
           RETURN  .t.
        endif
       
        inkey( .5 )

        nSeconds -= 0.5
    enddo
RETURN .f.

IMPORTANT: you must unlock the new record when you are ready editing it: tools->( dbUnLock() )

Maybe this could help you.

Regards,
Detlef
User avatar
Detlef Hoefner
 
Posts: 312
Joined: Sat Oct 08, 2005 9:12 am
Location: Germany

Postby James Bott » Tue Oct 28, 2008 6:44 pm

Darrell

You may also want to take a look at these articles. This info is from my notes and I didn't check to see if the links are still valid.

Regards,
James

-----------------------------
4/27/2005 7:08 AM

Windows' Oppontunistic Locking

Is well described at:
http://www.dataaccess.com/whitepapers/o ... ching.html

There are some programs for testing network op locking and for updating the registry here:

http://drouillard.ca/Tips&Tricks/Samba/Oplocks.html
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby cdmmaui » Wed Oct 29, 2008 1:47 am

Thank You for the information
*~*~*~*~*~*~*~*~*~*
Darrell Ortiz
CDM Software Solutions, Inc.
https://www.cdmsoft.com
User avatar
cdmmaui
 
Posts: 689
Joined: Fri Oct 28, 2005 9:53 am
Location: Houston ∙ Chicago ∙ Los Angeles ∙ Miami ∙ London ∙ Hong Kong


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 75 guests