Berikut contoh penggunaan select between date MsSQL di VB6. Misal akan digunakan untuk mencari data berdasar periode tanggal dan ditampilkan di grid.
Perhatikan penggunaan Format(DTPicker1.Value, "mm/dd/yyyy") , karena sering kali di SQL analizer jalan tapi di VB form jalan tapi salah data yg ditampilkannya
Private Sub Command5_Click()
Call BukaDatabase
Adodc3.ConnectionString = STRKoneksi
Adodc3.RecordSource = "SELECT * FROM transaksi where Tanggal between '" & Format(DTPicker1.Value, "mm/dd/yyyy") & "' and '" & Format(DTPicker2.Value, "mm/dd/yyyy") & "'"
Adodc3.Refresh
Set DataGrid1.DataSource = Adodc3
End Sub
Saturday, March 06, 2010
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment