mssql server ExecuteNonQuery()注意问题
例如用ExecuteNonQuery()方法执行create操作
SqlConnection conn = new SqlConnection("Data Source=.;Initial Catalog=PSDB;Integrated Security=SSPI");
string str = "CREATE TABLE aaa ( " +
"[ID] [int] IDENTITY (1, 1) NOT NULL , " +
"[BasicID] [int] NULL ," +
"[AdoptedName] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ," +
"[AdoptedSex] [char] (2) COLLATE Chinese_PRC_CI_AS NULL ," +
"[AdoptBirthday] [smalldatetime] NULL ," +
"[AdoptedType] [varchar] (100) COLLATE Chinese_PRC_CI_AS NULL ," +
"[ApprTime] [smalldatetime] NULL ," +
"[Remark] [varchar] (500) COLLATE Chinese_PRC_CI_AS NULL " +
") ON [PRIMARY] ";
SqlCommand comm = new SqlCommand(str, conn);
int i = 10;
try
{
conn.Open();
i = comm.ExecuteNonQuery();
conn.Close();
}
catch (Exception ex)
{
Response.Write(ex.Message);
}
Response.Write(i.ToString());
上一篇: PHP在特殊字符前加斜杠的实现代码
下一篇: predis的set速度测试
推荐阅读
-
mssql server ExecuteNonQuery()注意问题
-
:CentOS下的mssql_connect()连接问题,出现"Unable to connect to server"问题。
-
CentOS上的mssql_connect()连接有关问题,出现"Unable to connect to server"有关问题
-
jdcb查询SQL Server数据乱码问题解决方法 博客分类: Oracle&MSSQL sql server
-
CentOS上的mssql_connect()连接有关问题,出现"Unable to connect to server"有关问题
-
MSSQL Server补丁安装常见问题
-
CentOS上的mssql_connect()连接有关问题,出现"Unable to connect to server"有关问题
-
php MsSql server时遇到的中文编码问题
-
自动清理 MSSQL Server Table Collation问题的解决方法
-
自动清理 MSSQL Server Table Collation问题的解决方法