与SQL数据库的连接 [英] Connection with SQL databases

查看:97
本文介绍了与SQL数据库的连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

需要将我的项目与SQL Server连接

Need to connect my project with SQL server

推荐答案

引用 [^ ]网站.



HTH
Refer this[^] site.



HTH


要连接到数据库,您需要ConnectionString,它定义了数据源和数据库名称

使用以下代码行

昏暗的ConString作为字符串

ConString ="Server =您的PC名称;数据库= dbname;集成安全性= SSPI"
将dim cnn用作新的sqlconnection(ConString)
cnn.open()
做某事
cnn.close()
To Connect to a database u need ConnectionString it define the data source and database name

use the following line of code

Dim ConString as string

ConString="Server=Your PC Name;Database=dbname;Integrated Security=SSPI"
dim cnn as new sqlconnection(ConString)
cnn.open()
do something
cnn.close()


您有什么样的项目?

您是.net的新手吗?是.net项目吗?

您应该考虑使用企业库中的数据应用程序块来实现数据库连接.....它在后台使用模式来完成所有事情....

您应该能够在网络上或类似的站点上很容易地找到示例:)
what sort of project do you have?

Are you new to .net? Is it a .net project?

You should consider using the data application block in the enterprise library for database connectivity .... it uses patterns in the background to do everything ....

You should be able to find examples easily enough on the web, or on sites like this :)


这篇关于与SQL数据库的连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆