Tim Borowsky

Tim Borowsky

  • NA
  • 7
  • 4.6k

Use C# to create SQLCE database table with numbers in name

Aug 5 2014 3:06 PM
Hello,
 
I'm trying to write an app that allows the user to select a date, and then create a table with that date's name (i.e. 8/5/2014), but the SQL query doesn't like the numbers being used.
 
cmd = new SqlCeCommand("CREATE TABLE " + dateTimePicker1.Value.Date.ToShortDateString()
+ " (Foo_ID NVARCHAR(20), FooData NVARCHAR(20))",
Conn);
 
Any suggestions? I'd rather not use a switch-case that spells out month/date/year, as that can get tedious. 
 
Thanks! 

Answers (1)