Ver Mensaje Individual
  #4 (permalink)  
Antiguo 04/07/2008, 15:57
Avatar de Peterpay
Peterpay
Colaborador
 
Fecha de Ingreso: septiembre-2007
Ubicación: San Francisco, United States
Mensajes: 3.858
Antigüedad: 17 años, 5 meses
Puntos: 87
Respuesta: una sola conexion para todo los form

Proyecto Agregar nuevo Elemento -- > Application Configuration File.

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.diagnostics>
<sources>
<!-- This section defines the logging configuration for My.Application.Log -->
<source name="DefaultSource" switchName="DefaultSwitch">
<listeners>
<add name="FileLog"/>
<!-- Uncomment the below section to write to the Application Event Log -->
<!--<add name="EventLog"/>-->
</listeners>
</source>
</sources>
<switches>
<add name="DefaultSwitch" value="Information" />
</switches>
<sharedListeners>
<add name="FileLog"
type="Microsoft.VisualBasic.Logging.FileLogTraceLi stener, Microsoft.VisualBasic, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"
initializeData="FileLogWriter"/>
<!-- Uncomment the below section and replace APPLICATION_NAME with the name of your application to write to the Application Event Log -->
<!--<add name="EventLog" type="System.Diagnostics.EventLogTraceListener" initializeData="APPLICATION_NAME"/> -->
</sharedListeners>
</system.diagnostics>
<connectionStrings>
<add name="nombredetuconexion" connectionString="tucadenadeconexion"/>
</connectionStrings>
</configuration>

eso en negritas lo tienes q agregar

y para usarale en toda tu aplicacion solo haces un agregar referencia a System.Configuration

despues solo Creas un objeto de tipo ConfigurationManager (miconfig)

miconfig.ConnectionStrings("nombredetuconexion").C onnectionString
__________________
Curso WF4
http://cursos.gurudotnet.com/ DF
Aprende HTML5