1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
| Imports System.Data
Imports System.Data.SqlClient
Imports System.Data.Common
Partial Class ListeEmployes
Inherits System.Web.UI.Page
Public dbpf As DbProviderFactory
Public oconn As DbConnection
Public oda As DbDataAdapter
Public cmd As DbCommand
Public str As String = "server=HALIMA-117F0348\SQLEXPRESS;database=confection;integrated security=true"
Public ods As DataSet
Public dr As DbDataReader
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
dbpf = DbProviderFactories.GetFactory("System.Data.SqlClient")
oconn = dbpf.CreateConnection
oconn.ConnectionString = str
oda = dbpf.CreateDataAdapter
oda.SelectCommand = oconn.CreateCommand
oda.SelectCommand.CommandText = "select * from Employe"
ods = New DataSet
oda.Fill(ods, "Employe")
GridView1.DataSource = ods.Tables("Employe")
GridView1.DataBind()
end sub |
Partager