SQLDataAdapter problem framing dates

G

grondaia

I am using a SQLDataAdaper to update data into a database Im setting
the updatecommand to a stored procedure and creating all the
paramaters. All seems to create correctly, however the sql command
that is passed to the database is framing all the dates with double
single quotes....its executing with text like:

exec spUpdateMoveTransaction
@equipmentID=63,@originID=22,@destinationID=48,@moveStatusID=4,@lowBoyID=NULL,@moveDate=''2005-08-30

00:00:00:000'',@round=NULL,@startTime=NULL,@stopTime=NULL,@createdByID=88,@lastUpdatedByID=181,@lastUpdateDate=''2005-08-30
15:34:10:300''


i pasted that directly from a trace. Why is the sqldataadapter using
two single quotes insted of one single quote to wrap dates. Any ideas?


Thanks
 
W

William \(Bill\) Vaughn

Ah, this is by design (I expect). Since the dates are sent as quoted
literals they have to be framed in single quotes. However, so does the SQL
string itself. This doubling up of the quotes tells the SQL compiler to
leave these single quotes in place so it replaces '' with ' .


--
William (Bill) Vaughn
President and Founder Beta V Corporation
Redmond, WA
(425) 556-9205
Microsoft MVP, Author, Mentor
Microsoft MVP
 

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

Similar Threads


Top