更新时间:2022-12-09 08:56:00
***将连接字符串放在App.Config文件中
It will be better to put connection string in App.Config file
<appsettings>
<connectionstrings>
<add name="AccountingWindowApplication.Properties.Settings.WinPhoneAppConnectionString">
connectionString="Data Source=COMPAQ-PC\SQLEXPRESS;Initial Catalog=WinPhoneApp;Integrated Security=True"
providerName="System.Data.SqlClient" />
</add></connectionstrings> </appsettings>
并用作
and use as
SqlConnection cn = new SqlConnection();
cn.ConnectionString = ConfigurationSettings.AppSettings["ConnectionString"].ToString();
cn.Open();
希望能解决您的问题.
注意:将代码更改为Oledb
Hope it will solve your problem.
note:change code to Oledb
请参阅您的旧帖子......并查看评论...
祝你好运;
refer to you older post.......and see comments...
Best of luck;