Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL Server & Visual Basic

Status
Not open for further replies.

cj92713696

Programmer
Nov 23, 2000
105
US
I've written a Visual Basic application that checks for the existence of a simple ASCII-based transaction files in a specific hard-coded directory and subsequently parses each file it encounters. After the file is parsed, it is moved to a "processed" directory.

My ASCII-based files look something like this:

Start->TableName=Table1
"Field1", "Field2", "StoreCode"
1,"Jack",AIR
2,"Bill",AIR
3,"John",AIR
End->TableName=Table1
Start->TableName=Table2
"Field1", "Field2", "Field3"
1,"Jack","4.00"
2,"Bill","5.00"
End->TableName=Table2

... etc. I might have 25 table's data in one transaction file. After I read each table identifier to determine the table being updated, I issue a delete request. This saves me the headache of having to calculate the changes to the table since the last update b/c I can just subsequently append the data read from this transaction file back to the SQl Server table.

My resolution to the problem: I had to issue a 10 second pause after issuing a delete request to each table to ensure the records were updated properly. Without this pause, it seemed that SQL wasn't finished deleting when I began appending new records to the same table.

My problem: I want to speed up this process b/c as you can see delaying 10 seconds after each table can cause heavy delays when 50 transactions are in the queue.

Is there a way (or a function) to determine if SQL is ready to handle table appends? Or perhaps a way to determine that the last command issued is complete?

Thanks for your help,
CJ
 
It seems strange that you have accidentally issued your command asynchronously. Usually the default Execute is synchronous. Thats more a VB question anyway.

The fast way to delete all rows from a table (I think thats what you are doing) is
TRUNCATE TABLE table1
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top