remplir une listview ado.net
dans mon application j'ai un listview mais je ne sais pas comment le connecter avec la bd.
dans la version vb6 ,la connection etait comme suit:
Code:
1 2 3
| ChaineSQL$ = "SELECT Ticket.iDate, Ticket.iTime, Ticket.iPoste, Ticket.iNumero, Ticket.iPaye, Ticket.iDuree, Ticket.iPrixVente FROM Ticket where format(idate,'yyyy/mm/dd') between '" & Format(dt1, "yyyy/mm/dd") & "' and '" & Format(dt2, "yyyy/mm/dd") & "' order by " & OrderBy & tri
Dim rs As DAO.Recordset
Set rs = iData.OpenRecordset(ChaineSQL$) |
pour version vb.net j'ai commencé par:
Code:
1 2 3 4 5 6 7 8 9
| ChaineSQL = "SELECT Ticket.iDate, Ticket.iTime, Ticket.iPoste, Ticket.iNumero, Ticket.iPaye, Ticket.iDuree, Ticket.iPrixVente FROM Ticket where format(idate,'yyyy/mm/dd') between '" & VB6.Format(dt1._Value, "yyyy/mm/dd") & "' and '" & VB6.Format(dt2._Value, "yyyy/mm/dd") & "' order by " & OrderBy & tri
Dim ds As DataSet
Dim cnx As New SqlConnection(My.Settings.BaseConnectionString)
Dim cmd As New SqlCommand
Dim da As SqlDataAdapter
cnx.Open()
cmd = New SqlCommand(ChaineSQL, cnx)
da.SelectCommand = cmd
da.Fill(ds) |
comment faire pour continuer?
comment traduire Set rs = iData.OpenRecordset(ChaineSQL$) en vb.net