开发者

Error with executing query in visual studio

开发者 https://www.devze.com 2023-03-10 06:30 出处:网络
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.

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:

  1. it shows table Query Definitions Differ wher is written

    "The CREATE TABLE SQL construct or statement is not supported."

    Click to conntinnous

  2. 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消