如何像表中插入,删除一行?

schweinsteiger 2003-12-15 04:52:39
各位老大,我是个c#的新手,向各位请教。
string source = "server = SQL-SERVER;"+ "uid = sa;pwd = saadmini;"+ "database = Northwind";
SqlConnection conn = new SqlConnection( source );
我这样建立连接,请问,如何插入,删除一行记录呢?
...全文
59 7 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
速马 2003-12-15
  • 打赏
  • 举报
回复
brightheroes(闭关(正在修练基本功))
你的名字差点让我看错,哈哈
(-:
程序的色彩 2003-12-15
  • 打赏
  • 举报
回复
楼上的兄弟都讲啦.
dotnba 2003-12-15
  • 打赏
  • 举报
回复
SqlCommand command = new SqlCommand("insert into table(id) values(1)",conn);
command.ExecuteNonQuery();
brightheroes 2003-12-15
  • 打赏
  • 举报
回复
我晕:)
brightheroes 2003-12-15
  • 打赏
  • 举报
回复
Sql语句来实现
string sqlStr = "delete from yourtalbe where id = 1";
sqlCommand cmd = new sqlCommand(sqlStr,conn);
conn.open();
cmd.ExecuteNonQuery()
conn.close();
Soking 2003-12-15
  • 打赏
  • 举报
回复
sql="insert into xxx (aa,bb,cc) values ('aa','bb','cc')";
SqlCommand sqlcomm = new SqlCommand();
conn.Open();
sqlcomm.ExcuteNoQuery(sql,conn);
conn.Close();
schweinsteiger 2003-12-15
  • 打赏
  • 举报
回复
大家帮忙啊!!谢谢了

111,097

社区成员

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

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

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