views:

52

answers:

1

I am trying to pull the data by date in vb.net. It is not throwing the error nor giving any result. Whereas It shows the results in table adapter configuration wizard when I try through query builder. I am using date time picker in the form. But I have formatted the date in the database as date.I am puzzled.

Private Sub ToolStripButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton1.Click

Try
    Dim dt As Date = CDate(tspTextDate.Text)          
    Me.Bank_transactionsTableAdapter.GetDataByDate(dt)

    'Catch ex As Exception
Catch ex As FormatException
    MessageBox.Show("date is  wrong", "Entry Error")
Catch ex As SqlException
    MessageBox.Show("SQL Server error#" & ex.Number _
                    & ":" & ex.Message, ex.GetType.ToString)

End Try
End Sub

rows of data

BT102   4/5/2010    BKS 200.00      1200.00 1400.00     
BT103   4/5/2010    BKS 200.00      1400.00 1600.00     
BT105   4/6/2010    BKS 200.00      1800.00 1800.00  
A: 

Thanks ho, I got the answer, Thanks to Classmate Vincent. For reasons unknown the Data Grid view was not bound to the Get data by. I changed it to Fill by and in the binding source of the Data grid view I created binding, made changes for Date time picker as date .It worked.