Ver Mensaje Individual
  #4 (permalink)  
Antiguo 21/03/2012, 17:13
Avatar de Joty89
Joty89
 
Fecha de Ingreso: marzo-2012
Mensajes: 8
Antigüedad: 12 años, 1 mes
Puntos: 0
Respuesta: Falla en conexión a SQL

USEN ESTER CODIGO ES MAS CORTO Y MAS FACIL DE ENTENDER


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using System.Windows.Forms;

namespace citas
{
public class coneccion
{

public SqlConnection cnx = new SqlConnection("data source = (local) ; initial catalog= basededatos; integrated security= true");
public void conecc()
{
try
{
cnx.Open();

}
catch (Exception)
{
MessageBox.Show("Error de coneccion a la base de datos", "Error", MessageBoxButtons.OKCancel, MessageBoxIcon.Error);

}
}


}
}