欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

C#动态创建表

程序员文章站 2023-12-28 11:52:52
...
SqlConnection conn = new SqlConnection();
conn.ConnectionString = "";
conn.Open();
SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;  
cmd.CommandText = "
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[user]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[user]
create table user(id int,name nvarchar(8) )";
cmd.ExecuteNonQuery();  

转载于:https://www.cnblogs.com/blackbean/archive/2011/04/23/2025486.html

上一篇:

下一篇: