用户特定代码未在访问中运行 [英] User specific code not running in access
问题描述
str =CREATE TABLE dbo.UserInfo(ID INT IDENTITY(1,1)PRIMARY KEY,name varchar(50),FormatColumn AS RIGHT('LS_00'+ CAST(ID AS VARCHAR(8)),8)PERSISTED );
SqlCommand cmd = new SqlCommand(str,con);
cmd.ExecuteNonQuery();
我在sql中使用此代码但是当我在访问detabase中运行此代码时,它显示错误plz帮助我。我想创建一个特定的代码,如_
ADM_001。访问数据库中的autogenertae formate
str = "CREATE TABLE dbo.UserInfo(ID INT IDENTITY(1,1) PRIMARY KEY,name varchar(50) ,FormatColumn AS RIGHT('LS_00' + CAST(ID AS VARCHAR(8)), 8) PERSISTED)";
SqlCommand cmd = new SqlCommand(str, con);
cmd.ExecuteNonQuery();
I Use this code in sql but when i run this code in access detabase it show error plz help me out . i want to create a specific code Like _
ADM_001 . which is autogenertae formate in access database
推荐答案
没有SQL IDENTITY等效关键字MSACCESS。你应该使用INT IDENTITY(1,1)PRIMARY KEY而不是COUNT AUTOINCREMENT NOT NULL PRIMARY KEY...请使用正确的等效ANSI SQL数据类型
请参阅此链接
http://msdn.microsoft.com/en- us / library / bb177899.aspx
i希望这个ll hep你
关心和谢谢
Sarva
Hi,
There is no SQL IDENTITY equivalent keyword in MSAccess. you should use "INT IDENTITY(1,1) PRIMARY KEY" instead of "COUNT AUTOINCREMENT NOT NULL PRIMARY KEY"... please use correct Equivalent ANSI SQL Data Types
Refer this link
http://msdn.microsoft.com/en-us/library/bb177899.aspx
i hope this ll hep you
Regards and thanks
Sarva
这篇关于用户特定代码未在访问中运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!