问题描述
我使用服务器和客户端,
在包含所有操作的服务器中(插入,更新,删除)
我试过这段代码,插入到表中,但是没有效果,甚至没有错误!!
I work with server and client,
In the server which contains All operations (Insert, update, Delete)
I tried this code, to insert into table, but there's no effect, or even error!!
InformationSystemDSTableAdapters.StudentTableAdapter StTA = new InformationSystemDSTableAdapters.StudentTableAdapter();
StTA.InsertStudent(St.FirstName, St.LastName, St.BirthDate, St.Address, St.Gender);
我使用数据集
所以,
我决定提前使用数据库
我为App.Config添加了连接字符串
I worked with dataset
So,
I desided to work with data base ahead
I added connection string to App.Config
<add name="InformationSystemDBCS" connectionString="Data Source=(LocalDB)\v11.0;AttachDbFilename=|DataDirectory|\InformationSystemDB.mdf;Integrated Security=True"
providerName="System.Data.SqlClient" />
然后我用这段代码连接它:
Then I used this code to connect it:
string ConString = WebConfigurationManager.ConnectionStrings["InformationSystemDBCS"].ConnectionString;
但是会发生以下错误:
错误15无法将带有[]的索引应用于表达式类型'System.Configuration.ConnectionStringSettingsCollection'E:\SVU \MWS \ 04 ADP_F14_Mohmad Aljinidi \ ADPProject \ InformationSystem \ InformationSystem \RemoteInf ormationSystem \ MyInformationSystem.cs 38 32 RemoteInformationSystem
推荐答案
这篇关于使用控制台项目连接到DataBase时出错!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!