Incorrect SQL conversion into String::Format statement.

  • Thread starter Thread starter Przemek
  • Start date Start date
P

Przemek

Hi
A problem is - how can I make that statement correct? - I would like to
SELECT somenthink like that:

String *SQLstatement = String::Format(S" SELECT * FROM Table WHERE Date =
{0}", DateTimePicker1->Value->ToShortDateString() );

There is a String statement (*SQLstatement) so I concatenate DateTimePicker1
value as string value too. But I've got an "incorrect data type error". Is
there any
solution to make this cnvertion clear - maybe using any SQL finction inside
string?.

[Access file - "Date" column type: DateTime, oleDbDataAdapter]
Good day, thanks for wrote.
 
Przemek said:
A problem is - how can I make that statement correct? - I would like to
SELECT somenthink like that:

String *SQLstatement = String::Format(S" SELECT * FROM Table WHERE Date =
{0}", DateTimePicker1->Value->ToShortDateString() );

I would suggest not doing that in the first place. Use parameters
instead, and you don't need to do any conversion yourself.
 
Back
Top