关闭

关闭

关闭

封号提示

内容

首页 C#数据库服务器配置.doc

C#数据库服务器配置.doc

C#数据库服务器配置.doc

上传者: Jocelyn秀珍 2017-10-12 评分 0 0 0 0 0 0 暂无简介 简介 举报

简介:本文档为《C#数据库服务器配置doc》,可适用于综合领域,主题内容包含C#数据库服务器配置usingSystemusingSystemCollectionsGenericusingSystemComponentMode符等。

C#数据库服务器配置usingSystemusingSystemCollectionsGenericusingSystemComponentModelusingSystemDatausingSystemDrawingusingSystemLinqusingSystemTextusingSystemWindowsFormsusingSQLDMOusingSystemConfigurationnamespacexgMIS{publicpartialclassxgdataset:Form{publicxgdataset(){InitializeComponent()}privatestringxgconfigprivatevoidcomboBoxDropDown(objectsender,EventArgse){SQLDMOApplicationsqlApp=newSQLDMOApplicationClass()SQLDMONameListsqlServers=sqlAppListAvailableSQLServers()for(inti=i<sqlServersCounti){objectsrv=sqlServersItem(i)if(srv!=){thiscomboBoxItemsAdd(srv)}}}privatevoidcomboBoxDropDown(objectsender,EventArgse){try{SQLDMOApplicationsqlApp=newSQLDMOApplicationClass()SQLDMOSQLServersrv=newSQLDMOSQLServerClass()comboBoxItemsClear()if(radioButtonChecked){srvLoginSecure=truesrvConnect(comboBoxText,,)}elsesrvConnect(comboBoxText,textBoxTextTrim(),textBoxTextTrim())if(srvDatabasesCount>){foreach(SQLDMODatabasedbinsrvDatabases){if(dbName!=){comboBoxItemsAdd(dbName)}}}}catch(Exceptioner){MessageBoxShow(erMessage)}}privatevoidcomboBoxSelectedIndexChanged(objectsender,EventArgse){}privatevoidbuttonClick(objectsender,EventArgse){try{SQLDMOApplicationsqlApp=newSQLDMOApplicationClass()SQLDMOSQLServersrv=newSQLDMOSQLServerClass()if(radioButtonChecked){srvLoginSecure=truesrvConnect(comboBoxText,,)}elsesrvConnect(comboBoxText,textBoxTextTrim(),textBoxTextTrim())if(srvDatabasesCount==){MessageBoxShow("连接失败")}else{if(radioButtonChecked){xgconfig="DataSource='"comboBoxText"'InitialCatalog='"comboBoxText"'IntegratedSecurity=True"}else{xgconfig="DataSource='"comboBoxText"'InitialCatalog='"comboBoxText"'PersistSecurityInfo=TrueUserID='"textBoxText"'Password='"textBoxText"'"}SystemConfigurationConfigurationconfig=ConfigurationManagerOpenExeConfiguration(ConfigurationUserLevelNone)configConnectionStringsConnectionStrings"xgMISPropertiesSettingsxgMISConnectionString"ConnectionString=xgconfigconfigConnectionStringsConnectionStrings"xgsqlconn"ConnectionString=xgconfigconfigConnectionStringsConnectionStrings"xgMISPropertiesSettingsxgMISConnectionString"ConnectionString=xgconfigconfigSave()MessageBoxShow("连接成功")thisClose()}}catch(Exceptioner){MessageBoxShow(erMessage)}}}}

用户评论(0)

0/200

精彩专题

上传我的资料

每篇奖励 +2积分

资料评价:

/6
0下载券 下载 加入VIP, 送下载券

意见
反馈

立即扫码关注

爱问共享资料微信公众号

返回
顶部