本文介绍了如何使与SQL Server的连接字符串.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我尝试使用app.config与数据库建立连接.
代码是这样的:
<? xml 版本 =" 1.0" 编码 =" utf-8" ? > < 配置 > < connectionStrings > < 添加 名称 =" jsl2connection" connectionString =" RABIN-PC \ SQLEXPRESS; Database = jsl2;" providerName =" System.Data.SqlClient" / > < /connectionStrings > < /configuration >
但是当我运行程序时,发生了如下错误:
不支持的关键字:"rabin-pc \ sqlexpress; database".
谁能帮我一个忙..
请给我一个主意,以及如何编写正确的连接字符串!或请输入正确的连接代码!在connectionstring
属性的开头.
进一步阅读
http://www.connectionstrings.com/ [ ^ ]
i have tried to make connection with database using app.config.
and the code is like this:
<?xml version="1.0" encoding="utf-8" ?> <configuration> <connectionStrings> <add name="jsl2connection" connectionString="RABIN-PC\SQLEXPRESS;Database=jsl2;" providerName="System.Data.SqlClient" /> </connectionStrings> </configuration>
but while i run the program , error occured like this:
Keyword not supported: ''rabin-pc\sqlexpress;database''.
can any one help me out ..
please give me and idea how to write correct connection string!!!or please write the correct connection code!!!
解决方案
这篇关于如何使与SQL Server的连接字符串.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!