Ver Mensaje Individual
  #2 (permalink)  
Antiguo 03/07/2012, 10:22
Avatar de difilippocarlos
difilippocarlos
 
Fecha de Ingreso: junio-2010
Mensajes: 109
Antigüedad: 14 años, 8 meses
Puntos: 1
Respuesta: [Ayuda]Graficos estadisticos en tiempo real

Modulo
Código:
Imports System.Data.OleDb
Module Conexion
    Public cnnSql As New OleDbConnection
    Public cmdSql As New OleDbCommand
    Public rs As DataTable
    Public varDSN As String
    Public Declare Function GetComputerName _
    Lib "Kernel32" Alias "GetComputerNameA" _
    (ByVal lpBuffer As String, ByVal nSize As Long) As Long

    Public Sub Conectarse()
        Dim DB As String
        Dim sServer As String
        Dim sSql As String
        cnnSql = New OleDbConnection

        DB = "SGC_CAROYA"
        sServer = "192.168.100.115"   'SRV2
        cnnSql.ConnectionString = "Provider=SQLOLEDB.1;Data Source=" & Trim(sServer) & ";Initial Catalog=" & Trim(DB) & ";UID=sa;PWD=password"

        'Seteo la DB
        sSql = "set CONCAT_NULL_YIELDS_NULL OFF"
    
        cnnSql.Open()
        cmdSql.Connection = cnnSql
        cmdSql.CommandType = CommandType.Text
        cmdSql.CommandText = sSql
        cmdSql.ExecuteNonQuery()
    End Sub

    Public Sub Desconectarse()
         cnnSql.Close()
    End Sub
End Module