Last active
November 22, 2021 11:42
-
-
Save devCcori/3e9b419747f58ba4f8b5e30b45200479 to your computer and use it in GitHub Desktop.
Connection SQL and Access
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'Conexión como Access para Arquitectura x86 | |
'Instalación de Nugget Packages | |
Install-Package System.Data.SqlClient -Version 4.8.3 | |
Install-Package System.IO -Version 4.8.3 | |
Imports System.Data.OleDb | |
Dim strcon As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=D:\Documents\Ventas.accdb" | |
Dim cn As New OleDbConnection() | |
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load | |
cn.ConnectionString = strcon | |
End Sub | |
'Conexión como SQL para Arquitetura x86 | |
'Instalación de Nugget Packages | |
Install-Package System.Data.SqlClient | |
Install-Package System.IO | |
Imports System.Data.SqlClient | |
'Para Windows Authentication | |
Dim cn As New SqlConnection("Server=.;DataBase=Ventas;Integrated Security=true") | |
'Para SQL Server Authentication | |
Dim cn As New SqlConnection("Server=.;DataBase=Ventas;Username="";Password="") | |
'Siempre al querer usar la conexcion inicializar con | |
cn.Open() | |
'y cerrar conexión con | |
cn.Close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment