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 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106
|
Public _Ds As New DataSet
Sub ChargementDataSet(ByVal item As String)
Dim Da As OleDbDataAdapter
Select Case item
Case "Tous"
_Ds.Clear()
Da = New OleDbDataAdapter("SELECT TblSymb.Id_Symb,TblSymb.Symbole, TblSymb.Market, TblSymb.[Actif] FROM TblSymb WHERE (((TblSymb.[Actif])=True));", My.Settings.DbConn)
da.Fill(_Ds, "TblSymbole")
Da = Nothing
With _Ds.Tables("TblSymbole").Columns("Id_Symb")
.Unique = True
.AllowDBNull = False
.ReadOnly = True
.AutoIncrement = True
.AutoIncrementSeed = 1
.AutoIncrementStep = 1
End With
da = New OleDbDataAdapter("SELECT TblCompagnie.* FROM TblCompagnie;", My.Settings.DbConn)
da.Fill(_Ds, "TblCompagnie")
Da = Nothing
With _Ds.Tables("TblCompagnie").Columns("Id_Comp")
.Unique = True
.AllowDBNull = False
.ReadOnly = True
.AutoIncrement = True
.AutoIncrementSeed = 1
.AutoIncrementStep = 1
End With
Dim DcClePrimComp As DataColumn = _Ds.Tables("TblCompagnie").Columns("Id_Comp")
da = New OleDbDataAdapter("SELECT JctSymbComp.IdSymb, JctSymbComp.IdComp FROM JctSymbComp;", My.Settings.DbConn)
da.Fill(_Ds, "JctSymbComp")
Da = Nothing
Try
With _Ds.Tables("JctSymbComp").Columns("IdSymb")
'.Unique = True
'.AllowDBNull = False
'.ReadOnly = True
End With
With _Ds.Tables("JctSymbComp").Columns("IdComp")
'.Unique = True
.AllowDBNull = False
'.ReadOnly = True
End With
Catch ex As Exception
Console.WriteLine(ex.ToString)
Console.WriteLine()
End Try
da = New OleDbDataAdapter("SELECT TblIndice.* FROM TblIndice;", My.Settings.DbConn)
da.Fill(_Ds, "TblIndice")
da = Nothing
'da = New OleDbDataAdapter("SELECT TblDonner.* FROM TblDonner;", My.Settings.DbConn)
'da.Fill(_Ds, "TblDonner")
'Da = Nothing
Da = New OleDbDataAdapter("SELECT TblNews.* FROM TblNews;", My.Settings.DbConn)
Da.Fill(_Ds, "TblNews")
Da = Nothing
Da = New OleDbDataAdapter("SELECT TblDonnerV2.* FROM TblDonnerV2;", My.Settings.DbConn)
Da.Fill(_Ds, "TblDonnerV2")
Da = Nothing
With _Ds.Tables("TblDonnerV2").Columns("IdAutoDonner")
.Unique = True
.AllowDBNull = False
.ReadOnly = True
.AutoIncrement = True
.AutoIncrementSeed = 1
.AutoIncrementStep = 1
End With
Try
Dim DcClePrim As DataColumn = _Ds.Tables("TblSymbole").Columns("Id_Symb")
Dim DcCleExt As DataColumn = _Ds.Tables("JctSymbComp").Columns("IdSymb")
Dim Dr As New DataRelation("SymbJonc", DcCleExt, DcClePrim)
_Ds.Relations.Add(Dr)
DcClePrim = _Ds.Tables("TblCompagnie").Columns("Id_Comp")
DcCleExt = _Ds.Tables("JctSymbComp").Columns("IdComp")
Dr = New DataRelation("CompJonc", DcClePrim, DcCleExt)
_Ds.Relations.Add(Dr)
Catch ex As Exception
Console.WriteLine(ex.ToString)
Console.WriteLine()
End Try
Case "DonnerV2"
_Ds.Tables("TblDonnerV2").Clear()
Da = New OleDbDataAdapter("SELECT TblDonnerV2.* FROM TblDonnerV2;", My.Settings.DbConn)
Da.Fill(_Ds, "TblDonnerV2")
Da = Nothing
With _Ds.Tables("TblDonnerV2").Columns("IdAutoDonner")
.Unique = True
.AllowDBNull = False
.ReadOnly = True
.AutoIncrement = True
.AutoIncrementSeed = 1
.AutoIncrementStep = 1
End With
End Select
End Sub |
Partager