用C#连接数据库 [英] Connect to Database in C#
本文介绍了用C#连接数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我创建了名为Medical.sdf的本地数据库。我无法在我的wpf应用程序中访问数据库及其表。为什么?
解决方案
http://msdn.microsoft.com/en-us/library/bb655884(v = vs.90).aspx [ ^ ]
C#数据库初学者项目 [ ^ ]
- KR
Q不清楚。连接字符串问题或者您无法读取数据? 。我认为.sdf文件的连接字符串是
试试这个
Provider = Microsoft.SQLSERVER.CE .OLEDB.3.5;数据源= myPath \ test.sdf; SSCE:加密数据库= True;
< connectionstrings >
< add name = DataConnectionString connectionstring = data source = SERVER-PC\SQLEXPRESS; integrated Security = True; initial catalog = OnlineExam; < span class =code-keyword>>
providerName =System.Data.SqlClient/>
< / add > < / connectionstrings >
I have created local database named Medical.sdf. I can not access database and its tables in my wpf application. why ?
解决方案
http://msdn.microsoft.com/en-us/library/bb655884(v=vs.90).aspx[^]
C# Project on Database for Beginners[^]
-KR
Q is Not clear.Connection string Problem or you can't read data ? . I think connection string for .sdf file is
try this
Provider=Microsoft.SQLSERVER.CE.OLEDB.3.5;Data Source=myPath\test.sdf; SSCE:Encrypt Database=True;
<connectionstrings> <add name="DataConnectionString" connectionstring="data source=SERVER-PC\SQLEXPRESS;integrated Security=True;initial catalog=OnlineExam;"> providerName="System.Data.SqlClient" /> </add></connectionstrings>
这篇关于用C#连接数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文