Advertisement
Guest User

Untitled

a guest
Oct 3rd, 2014
258
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 1.13 KB | None | 0 0
  1.  
  2.  
  3.  
  4.  
  5.  
  6.         Dim cn As New OleDb.OleDbConnection
  7.         cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\Firebird.mdb"
  8.         cn.Open()
  9.  
  10.         Dim dt1 As DateTime = DateTimePicker1.Value.Date
  11.         Dim dt2 As DateTime = DateTimePicker2.Value.Date
  12.         'MsgBox(dt1)
  13.         Try
  14.  
  15.             MsgBox(dt1 + " " + dt2)
  16.  
  17.             Dim cmd As OleDbCommand
  18.             Dim dt As DataTable
  19.             Dim Da As OleDbDataAdapter
  20.             With Cmd
  21.  
  22.  
  23.                 .CommandType = CommandType.Text
  24.                 .CommandText = "select * FROM OS where data between @datainicial AND @datafinal"
  25.                 .Parameters.AddWithValue("@datainicial", dt1)
  26.                 .Parameters.AddWithValue("@datafinal", dt2)
  27.                 .Connection = cn
  28.             End With
  29.  
  30.             With OSTableAdapter.Adapter
  31.                 .SelectCommand = cmd
  32.                 dt = New DataTable
  33.                 .Fill(dt)
  34.                 OSDataGridView.DataSource = dt
  35.             End With
  36.  
  37.             cn.Close()
  38.         Catch ex As Exception
  39.             MsgBox(ex.Message)
  40.         End Try
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement