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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Repeated Sql statement in the Application

Status
Not open for further replies.

motto

Programmer
May 28, 2000
23
IN
Hi,<br><br>&nbsp;&nbsp;&nbsp;I am working in the financial application product.<br>where i use vb as my front end and oracle as Back end.<br>In this case,i execute lot of sql statements<br>more over same sql statement in many places.<br>This is quite one of the reasons for<br>increase of application size.How to handle<br>If I am using same sql statement in many places.<br>How to overcome this problem.<br><br>Thanks in advance.<br>Motto<br>
 
well if its in many forms too, just make a global string like you can create a module to do that (or if its all in a single form, create it there in top)<br>Public Const SqlAddCommand = &quot;Insert into Table (...) value (...)&quot;<br><br>so on, its easier just to save them into strings, and just call the variable everytime, or you can create a function or subroutine, that does the same set of commands, and call those over and over again. <p>Karl<br><a href=mailto:kb244@kb244.8m.com>kb244@kb244.8m.com</a><br><a href= </a><br>Experienced in , or have messed with : VC++, Borland C++ Builder, VJ++6(starting),VB-Dos, VB1 thru VB6, Delphi 3 pro, Borland C++ 3(DOS), Borland C++ 4.5, HTML,Visual InterDev 6, ASP(WebProgramming), QBasic(least i didnt start with COBOL)
 
Hi motto, KB244 has answered your question. But if still you want to save those sql statements bytes then store that sql statment in a stored procedure (SP) and just call it as when required basis.
 
Just storing it as a Stored Procedure seems like the best thing to do.<br>&nbsp;It could be something like a commission calculator which gets data&nbsp;&nbsp;(a percentage) from a field called <b>sales_comm </b>and then multiplies that by a field called <b>total_sales</b> and then updates a payroll sheet, now in a big sales/finance firm this can be a constant thing (esp brokerage firms) SP is the way to go.<br><br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top