Sqlconnection Sqlcommand Sqldataadapter Dataset Datatable Datarow

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

Imports System.

Data
Imports System.Data.OleDb
Imports System.Data.SqlClient
Module Module1
Public myconnection As SqlConnection
'declaration objet commande
Public mycommand As SqlCommand
Public oda As New SqlDataAdapter
Public ods As New DataSet
Public strsql As String
Public odt As DataTable
Public objetdatarow As DataRow
Public rownum As Integer
Public strconn As String
Public objetcommandbuilder As SqlCommandBuilder
End Module

--------------------------

Public Class Form1

Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load


Dim myconnection As SqlClient.SqlConnection = New SqlClient.SqlConnection("Data
Source=DELL-PC;Initial Catalog=gestion commande cours;Integrated Security=True")
Dim mycommand As SqlClient.SqlCommand = myconnection.CreateCommand()
mycommand.CommandText = "select * from clients"
myconnection.Open()
mycommand = New SqlClient.SqlCommand(mycommand.CommandText)
oda = New SqlClient.SqlDataAdapter(mycommand)
mycommand.Connection = myconnection
oda.Fill(ods, "clients")
odt = ods.Tables("clients")
objetdatarow = ods.Tables("clients").Rows(rownum)
TextBox1.Text = odt.Rows(rownum).Item("code_clt")
TextBox2.Text = odt.Rows(rownum).Item("nom_clt")
TextBox3.Text = odt.Rows(rownum).Item("ville")
End Sub

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

End Sub
End Class

You might also like