Crear una conecci贸n ADO COn SQL server
Necesito saber como hacer una conecci贸n ADO en visual Basic con SQL server yo utilizo la Referencia ADO
Public ADOCONN As New ADODB.Connection 'CONEXION*************
Public Function conex()
ADOCONN.ConnectionString = " Provider=SQLOLEDB.1;Persist Security Info=False;User ID=SA;Initial Catalog=SISVA;Data Source=HIGHLIFE"
ADOCONN.Open
End Function
Public Function desconectar()
ADOCONN.Close
End Function
LLAMADA DE FUNCION*****************************
Call conex
RST_SECCION.Source = "INSERT INTO TB_SECCIONES VALUES(" & Txt_CvlSeccion.Text & ",'" & Txt_DescriNivel.Text & "','" & Txt_Supervisor.Text & "')"
RST_SECCION.ActiveConnection = ADOCONN
MsgBox "REGISTRO ALMACENADO", vbExclamation
RST_SECCION.Open
desconectar
Public Function conex()
ADOCONN.ConnectionString = " Provider=SQLOLEDB.1;Persist Security Info=False;User ID=SA;Initial Catalog=SISVA;Data Source=HIGHLIFE"
ADOCONN.Open
End Function
Public Function desconectar()
ADOCONN.Close
End Function
LLAMADA DE FUNCION*****************************
Call conex
RST_SECCION.Source = "INSERT INTO TB_SECCIONES VALUES(" & Txt_CvlSeccion.Text & ",'" & Txt_DescriNivel.Text & "','" & Txt_Supervisor.Text & "')"
RST_SECCION.ActiveConnection = ADOCONN
MsgBox "REGISTRO ALMACENADO", vbExclamation
RST_SECCION.Open
desconectar