//实例化sql连接
SqlConnection conn = new SqlConnection("server=.; database=dbName; uid=sa; pwd=sa");
conn.Open();
//实例化sql命令
SqlCommand cmd = new SqlCommand(sqlStr, conn);
//执行sql命令
cmd.ExecuteNonQuery();
//关闭连接
conn.Close();
.net 动态创建sql数据库表,布布扣,bubuko.com
原文地址:http://blog.csdn.net/love33jing2012/article/details/37502835