Data Access Using SqlClient 'Con esta clase se pueden ejecutar sentencias de Select, Update, Insert, Detele Imports System.Data.SqlClient Public Class DataLayer Private ConexionStr As String = "Data Source=SERVIDOR\sqlexpress;Initial Catalog=dbAsVentas;Integrated Security=True" Private strSQL As String Public Property ConexionString() As String Get Return ConexionStr End Get Set(ByVal value As String) ConexionStr = value End Set End Property ''' ''' Ejecuta Comandos de Update, Insert, Delete ''' Instruccion SQL que se ejecutara ''' Public Function SaveData(ByVal SqlInstrucction As String) As Boolean Dim oConexion As New SqlConnection(ConexionStr) Dim oComand As SqlCommand Try oConexion.Open() oComand = New SqlCommand(SqlInstrucction, oConexion) oComand.ExecuteNonQuery() oConexion.Close() oConexion.Dispose() oComand.Dispose() Return True Catch ex As Exception 'Error si la conexion falla ...
Blog para compartir la experiencia que se puede ir adquiriendo con el tiempo en el mundo de la programacion