新建一张数据表的语句?

来源:百度知道 编辑:UC知道 时间:2024/06/30 23:19:56

create table [表名](
列名 类型 约束,
.............
............
);

直接执行建表SQL语句就行了啊

SqlConnection conn = new SqlConnection("连接字符串");
SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;
cmd.CommandType = CommandType.Text ;
cmd.CommandText = "create table 表名 (...表结构)";
cmd.ExecuteNonQuery();
conn.Close();