怎么创建表,取表,录入数据?

jiaochengli 2010-10-10 12:25:58
大侠们帮帮忙呀!

就是如何创建表,填写表名,填写字段,字段类型

然后取出表,录入数据!
...全文
80 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
cjh200102 2010-10-13
  • 打赏
  • 举报
回复
楼上正解
liuqilin1987 2010-10-10
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 ainishalasha1987 的回复:]
核心语句:创建表的操作
SqlConnection conn = null;
try
{
conn = GetConnection();
SqlCommand cmd = new SqlCommand();

cmd.CommandText = "create table 表名(列名 及其相关设置)";
cmd.Connection = conn;……
[/Quote]
3楼正解,就是在SqlCommand写入SQL语句,与数据库中的语句一样
ainishalasha1987 2010-10-10
  • 打赏
  • 举报
回复
核心语句:创建表的操作
SqlConnection conn = null;
try
{
conn = GetConnection();
SqlCommand cmd = new SqlCommand();

cmd.CommandText = "create table 表名(列名 及其相关设置)";
cmd.Connection = conn;
}


catch
{
throw;
}
finally
{
if (conn != null)
{
conn.Close();
}
}
}
wuyq11 2010-10-10
  • 打赏
  • 举报
回复
create table test
(
userid int,
username nvarchar(100)
)
select * from test
sqlcommand 执行sql create table创建
q107770540 2010-10-10
  • 打赏
  • 举报
回复

create table tb
(
id int ,
name,nvarchar(50)
)


ADO.NET
beautiful_melody 2010-10-10
  • 打赏
  • 举报
回复
Microsoft SQL Server Management Studio里图形化创建

还有就是应用楼上的代码

110,561

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧