Conexion Con SQL

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 1

Imports System.Data.

SqlClient
Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim con As New SqlConnection(My.Settings.CONEXION)

Dim sql As String = "SELECT ID_PRODUCTO, DENOMINACION, PRESENTACION,


PRECIO FROM PROYECTO"

Dim CMD As New SqlCommand(sql, con)

Try
Dim da As New SqlDataAdapter(CMD)
Dim ds As New DataSet

da.Fill(ds, "PROYECTO")

Me.DataGridView1.DataSource = ds.Tables("PROYECTO")

Catch ex As Exception
MsgBox(ex.Message)

End Try

End Sub
End Class

You might also like