在visual studio 2010 中怎么编程应用sql server数据库啊?

如题所述

代码是这样的
using System.Data.SqlClient;
string ConnStr=“Data Source=.;Initial Catalog=数据库名字;Integrated Security=True"
sqlconnection conn = new sqlconnection(ConStr);
conn.open();
sqlcommand cmd = new sqlcommand();
cmd.commandtext=”这里面是SQL语句,要写什么就看你要对数据库执行什么操作了“;
conn.close();
这么是必须要用到的。有什么不清楚的可以追问我,谢谢。
温馨提示:答案为网友推荐,仅供参考
第1个回答  2011-12-04
1、使用控件
2、自己编写程序
建议你到www.csdn.net的论坛
第2个回答  2011-12-04
你是要连接数据库对数据表进行操作吗?追问

对啊!!

追答

在msdn中查询sqlconnection类,sqlcommand类 等等... 的用法,你就知道了。

相似回答