日期:2014-05-18  浏览次数:20374 次

.net sql2000 数据库如何连接和添加,修改,删除 ,小弟是新手~在线等~请大家帮助
如题

------解决方案--------------------
SqlConnection newSQLConnection = new SqlConnection( "server=127.0.0.1;database=OrderForm;User ID=sa;Password=; ");
newSQLConnection.Open(); //连接数据库

SqlCommand newSQLCommand = new SqlCommand( "添加,修改,删除的SQL语句 ",newSQLConnection);
newSQLCommand.ExecuteNonQuery();//执行SQL语句
------解决方案--------------------
http://blog.csdn.net/zhaoxiaoyang5156/archive/2007/05/26/1627177.aspx
把这个例子吃了。。你就会了。
------解决方案--------------------
SqlConnection newSQLConnection = new SqlConnection( "server=127.0.0.1;database=OrderForm;User ID=sa;Password=; ");
newSQLConnection.Open(); //连接数据库

SqlCommand newSQLCommand = new SqlCommand( "添加,修改,删除的SQL语句 ",newSQLConnection);
newSQLCommand.ExecuteNonQuery();//执行SQL语句


楼上的兄弟说得对!
补充一下:
SqlDataAdapter adp = new SqlDataAdapter(sql, conn);
填充dataset datatable 时要用到的
------解决方案--------------------
查询用非连接环境,更新用连接环境