关闭

关闭

关闭

封号提示

内容

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

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

C#数据库服务器配置

Jocelyn秀珍
2017-10-12 0人阅读 0 0 0 暂无简介 举报

简介:本文档为《C#数据库服务器配置doc》,可适用于综合领域

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)

关闭

新课改视野下建构高中语文教学实验成果报告(32KB)

抱歉,积分不足下载失败,请稍后再试!

提示

试读已结束,如需要继续阅读或者下载,敬请购买!

评分:

/6

意见
反馈

立即扫码关注

爱问共享资料微信公众号

返回
顶部

举报
资料