
27/11/2008, 14:19
|
 | | | Fecha de Ingreso: marzo-2008 Ubicación: Camaná - Arequipa
Mensajes: 213
Antigüedad: 16 años, 10 meses Puntos: 4 | |
leer cadena de conexion de un xml o txt externo hola, tengo un programa que trabaja con bases de datos (sql 2005 express) y quisiera crear una ventana en donde el usuario configure su propia cadena de conexion, y no depender del app.config, como lograria esto? lo leeria de un xml externo?
!Ayuda !
miren en un proyecto que cree , no habia app.config , la aplicacion lo leia de un archivo, settings.settings
Option Strict On
Option Explicit On
Namespace My
<Global.System.Runtime.CompilerServices.CompilerGe neratedAttribute(), _
Global.System.CodeDom.Compiler.GeneratedCodeAttrib ute("Microsoft.VisualStudio.Editors.SettingsDesign er.SettingsSingleFileGenerator", "8.0.0.0"), _
Global.System.ComponentModel.EditorBrowsableAttrib ute(Global.System.ComponentModel.EditorBrowsableSt ate.Advanced)> _
Partial Friend NotInheritable Class MySettings
Inherits Global.System.Configuration.ApplicationSettingsBas e
Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSetti ngsBase.Synchronized(New MySettings), MySettings)
#Region "Funcionalidad para autoguardar de My.Settings"
#If _MyType = "WindowsForms" Then
Private Shared addedHandler As Boolean
Private Shared addedHandlerLockObject As New Object
<Global.System.Diagnostics.DebuggerNonUserCodeAttr ibute(), Global.System.ComponentModel.EditorBrowsableAttrib ute(Global.System.ComponentModel.EditorBrowsableSt ate.Advanced)> _
Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs)
If My.Application.SaveMySettingsOnExit Then
My.Settings.Save()
End If
End Sub
#End If
#End Region
Public Shared ReadOnly Property [Default]() As MySettings
Get
#If _MyType = "WindowsForms" Then
If Not addedHandler Then
SyncLock addedHandlerLockObject
If Not addedHandler Then
AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings
addedHandler = True
End If
End SyncLock
End If
#End If
Return defaultInstance
End Get
End Property
<Global.System.Configuration.ApplicationScopedSett ingAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttri bute(), _
Global.System.Configuration.SpecialSettingAttribut e(Global.System.Configuration.SpecialSetting.Conne ctionString), _
Global.System.Configuration.DefaultSettingValueAtt ribute("Data Source=.\SQLEXPRESS;Initial Catalog=EMPPV2008;Integrated Security=True")> _
Public ReadOnly Property EMPPV2008ConnectionString() As String
Get
Return CType(Me("EMPPV2008ConnectionString"), String)
End Get
End Property
End Class
End Namespace
Namespace My
<Global.Microsoft.VisualBasic.HideModuleNameAttrib ute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttri bute(), _
Global.System.Runtime.CompilerServices.CompilerGen eratedAttribute()> _
Friend Module MySettingsProperty
<Global.System.ComponentModel.Design.HelpKeywordAt tribute("My.Settings")> _
Friend ReadOnly Property Settings() As Global.FacturaNow.My.MySettings
Get
Return Global.FacturaNow.My.MySettings.Default
End Get
End Property
End Module
End Namespace
__________________ Soluciones basadas en .NET Framework y SQL Server |