Most effective way of coding

giedrius

Registered User.
Local time
Today, 18:53
Joined
Dec 14, 2003
Messages
80
Hello,

I am using simple INSERT INTO query a lot of times in different forms. What would be more effective - to put INSERT INTO once in a procedure and call it every time it is needed or simply use INSERT INTO a number of times as needed?

Thanks,
giedrius
 
If you call a piece of code more than once, it's best to reference that piece of code using a call rather than having the same code in your program twice. If you need to alter the code, you'll just change it once.
 
Yes, I take your point that is is more convenient for coding. But is it faster in execution? I have no clue how many lines of low level code A2K adds for a simple INSERT INTO sql statement. If it is hundreds of lines, than probably it is more efficient to have INSERT once in a subroutine and call it every time it is needed.

On the other hand if you use exactly the same INSERT or any other sql statement in your code you can easily change it with Visual Basic's Ctrl-H (Replace).

giedrius
 
I'm guessing that your queries are in no way dynamic which means that you don't need code at all. Just create a stored query - this is fastest.
 
I presume stored queries are only possible while working with SQL Server. I have a simple peer-to-peer configuration and I use DAO.

giedrius
 
No, a stored query is just a query object in Access. I say 'stored' because I'm guessing you are creating them on the fly when it's probably not necessary.
 
Mile-O-Phile said:
No, a stored query is just a query object in Access. I say 'stored' because I'm guessing you are creating them on the fly when it's probably not necessary.

Yes, you are right. I made simple things complicated.

Thanks.
giedrius
 

Users who are viewing this thread

Back
Top Bottom