Click here to Skip to main content
15,885,985 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
why does when I put the command at VB2008 error pop-ups saying:

Conversion failed when converting the nvarchar value 'ID' to data type int.


When I run it on SQL 2008 it works fine.


VB
ds2 = MonthCalendar1.SelectionStart.ToShortDateString

SQL
IF NOT EXISTS(SELECT 0 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = "TimeTB" AND COLUMN_NAME = " & ds2 & ")BEGIN ALTER TABLE TimeTB ADD ["& ds2 &"] nvarchar(50) DEFAULT 'FREE' NOT NULL END
Posted
Updated 4-Mar-11 3:30am
v3

1 solution

The only thing that occurs to me is your use of '&'. What is this for? Do you actually want "& 04/02/2011 &" as your column name?

Even if this is valid the string you are looking for is slightly different (it has extra spaces before the first '&' and after the last one) from the one you are adding, I don't know if this is deliberate.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900