Questions

Answer for:

SQL Statement in VB6 Code

Message 8 of 12

View entire thread
+
0 Votes
simonmlarsen

If not ignore my post.

If it is you are approaching this so wrong it is not funny.

For starters that style of join syntax is deprecated.

Secondly take advantage of the performance sql has rather than messing about with ad hoc statements.

Thirdly don't create strings, security nightmare.

try this.

From query analyser or SSMS (depending on version).

create proc pr_sWhatever @strSuit varchar (8000) = Null
as
set nocount on

SELECT i.fldSuit, i.fldRCR, p.fldPDate, p.fldPaid, p.fldBalance,
p.fldCashier, p.fldRecNum, p.fldVchNum, p.fldSuit
From tblInfo i join
tblPayments p
on i.fldSuit = p.fldSuit
Where p.fldSuit = @strSuit
go

I have put a varchar 8000, check what you actually need there.

then your string is

strQuery = "pr_sWhatever " & strSuit

except of course this is not ado style code.

You probably want to create an ado command object and declare the parameter and set it.

bam! performance and security all in one quick hit.