干扁鱼的

干扁鱼

 

使用sqlconnection对象来和sql server数据库建立连接

使用sqlconnection对象来和sql server数据库建立连接,连接字符串为:

"data source=(local);initial catalog=myschool;integrated security=SSPI"



data source=(local)   --------------------连接到本地的SQL SERVER;
initial catalog=myschool-----------------把myschool作为默认的数据库;
integrated security=SSPI----------------使用windows的认证机制来登陆到sql server
                                                                                         (不容输入账号和密码)

如果不想用windows的认证机制,而是希望自己输入用户名和密码,连接字符串为:

"data source=(local);initial catalog=mychool;User ID=AA;password=AA"

data source=(local)   --------------------连接到本地的SQL SERVER;
initial catalog=myschool-----------------把myschool作为默认的数据库;
User ID=AA   -------------------------用户名AA
password=AA--------------------------密码AA

posted on 2007-03-26 10:19  beihangyjs  阅读(1289)  评论(0)    收藏  举报

导航