dates sql and aspc....

L

luna

sql query in code looks like this :-

sql = "INSERT INTO livetracker
(ID,MortgageSourced,PostalPackIssued,PostalPackReturned,SalesManager,Mortgag
eAdministrator,DateToMortgageAdmin,MortgageAppSubmitted,Lender,LendersRefere
nce,Solicitor,OfferIssued,CompCheckedBy,ToSales,CalledBy,MortgageResourced,C
allOutcome,OfferChecked) VALUES ('" + userid.Text.ToString + "' , " & msl +
" , " + pit + " , " + prt + " , '" + smo + "' , '" + ma + "' , " + dtma + "
, " + ms + " , '" + lend + "' , '" + lr + "' , '" + sol + "' , " + off + " ,
'" + comp + "' , " + tsl + " , '" + cc + "' , " + mr + " , '" + outc + "' ,
" + offchk + ");"

which outputs :

INSERT INTO livetracker
(ID,MortgageSourced,PostalPackIssued,PostalPackReturned,SalesManager,Mortgag
eAdministrator,DateToMortgageAdmin,MortgageAppSubmitted,Lender,LendersRefere
nce,Solicitor,OfferIssued,CompCheckedBy,ToSales,CalledBy,MortgageResourced,C
allOutcome,OfferChecked) VALUES ('99' , 03/02/2004 , 03/02/2004 , 03/02/2004
, '' , '48' , 03/02/2004 , 03/02/2004 , '' , '' , '' , , '48' , 03/02/2004
, '48' , 03/02/2004 , '' , 03/02/2004);


but in the sql table all the dates are 01/01/1900 (im working in british
date format)

incidently im unsure as to where the 48s are coming from either!!

thanks

mark
 
S

Scott Allen

Just a couple suggestions:

1 - Parameterize the query. Building SQL strings in this fashion puts
you at a higher risk of injection attacks. It will also provide a
little more type safety. I don't think this will solve your problem
but it might prevent other problems down the road.
Some parameterized query examples are here:
http://msdn.microsoft.com/library/d...html/cpconusingparameterswithdataadapters.asp

2 - Give us some more to work with. It's hard to see the exact problem
because I don't know if the variable msl is a date time or a string
or...

Hope this helps,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,046
Latest member
Gavizuho

Latest Threads

Top