That code is a SQL injection attack just waiting to happen. Use the SqlCommand class; it handles .Net data types like dates, and prevents SQL injection.
you have an extra '. this line:
strSQL += "AND Rr.RrCoe Between ''" & strCalStartDate & "' AND '" & strCalEndDate '"
should read:
strSQL += "AND Rr.RrCoe Between '" & strCalStartDate & "' AND '" & strCalEndDate '"
colofornia
ASKER
tx emoreau,
I pasted the should read line in and now the error is:
Unclosed quotation mark before the character string '4/10/2008 order by CNaSh, PI '.
Line 1: Incorrect syntax near '4/10/2008 order by CNaSh, PI '.
I'm not bright enough to know HOW, but I think I see that my VB.Net SQL mash is creating a string out of things I don't want in a string... like I need to end the string right after the date.
http://msdn2.microsoft.com/en-us/library/system.data.sqlclient.sqlcommand(VS.80).aspx