Error with executing query in visual studio
I created databese like server exploler/ data connection / add connection . Microsoft SQ开发者_高级运维L Server Compact 3.5 (.NET Framework) use Create and create my own MyDatabes.sdf file.
Now in server exploler right click on my databese --- and click on new query
.
Try run this:
Create table [student]
(
[student_id] Bigint NOT NULL,
[bornnumber] Varchar(10) NOT NULL,
[branch] Integer NOT NULL,
[specialization] Integer NOT NULL,
[year] Smallint NULL,
[studygroup] Varchar(5) NOT NULL,
[started] Datetime NULL,
[finished] Datetime NULL,
[status] Char(1) NULL,
Primary Key ([student_id])
)
press execute query:
it shows table Query Definitions Differ wher is written
"The CREATE TABLE SQL construct or statement is not supported."
Click to conntinnous
Shows SQL Executation ERROR
"Error Source: SQL Server Compact ADO.NET Data PRovider Error Message: The specified data type is not valid.[Data type (if known)=Varchar]";
I hope query is fine... and I hope ADO,NET know Varchar. Please Do you know were is problem ?
using Visual Studio 2010 Ultimate.
varchar(n)
is indeed not supported on CE; only unicode nvarchar(n)
, nchar(n)
and ntext
. Change to nvarchar(10)
, nvarchar(5)
and nchar(1)
, etc.
Also; start with the simplest operation (table etc) that works - and keep expanding it until it breaks, then you'll know which bits fail.
精彩评论