当前位置:编程学习 > C#/ASP.NET >>

大神帮忙!C#系统连接SQL的问题

本菜鸟是大四生,要做毕业设计,我的SQL是本地 Windows 身份验证登陆的。请问该怎样在C#系统里连接到数据库呢?是这样写吗“ public static SqlConnection My_con;
        public static string M_str_sqlcon = "Data Source=PC-20130831QRCZ;Database=db_PWMS;User id=PC-20130831QRCZ\\Administrator;";”以下是图片 --------------------编程问答--------------------
"Data Source=数据库IP;Initial Catalog=数据库名称;Persist Security Info=True;User ID=UserName;Pwd=Password"
--------------------编程问答-------------------- 集成验证使用当前用户身份登录,不需要指定用户名和密码。Integrated Security=true

参考
http://www.cnblogs.com/yongqiudeng/archive/2008/02/12/1067342.html
--------------------编程问答-------------------- 参考这个文章实现:
http://www.cnblogs.com/rainman/archive/2012/03/13/2393975.html

string connectString = "Data Source=.;Initial Catalog=Student;Integrated Security=True";
--------------------编程问答-------------------- 跟同学讨论了,确实解决了这个问题,谢谢大家 --------------------编程问答-------------------- 大四了,看来你的同学都很热情的讨论解决问题 --------------------编程问答--------------------
2 string connectString = "Data Source=.;Initial Catalog=Student;Integrated Security=True"; 
你试试这样写 --------------------编程问答-------------------- 也是一个关于sql语句的问题,求大神帮忙
http://bbs.csdn.net/topics/390582185 --------------------编程问答-------------------- 大学这几年你都干啥了?我承认我读大学的时候已经很懒了,没想到你比我还懒,都快毕业了连个数据库连接还得发帖求助。骚年,你脑子被驴踢了吧?劝你还是做点别的事吧,别把青春浪费在编程上了。。。
补充:.NET技术 ,  C#
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,