none
Search for a date RRS feed

  • Question

  • Goodday , i have the below query to search for a row in the Language column, but how can i write this query to search for a date? In other words to exchange the word language for date in the below code snippit. I would like to entre the date in the textbox in a format like this'2010/09/13'or similar. thanks rob

     

     

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

     

     

    Dim db As New LinqToSqlDataContext

     

     

    Dim SearchLanguage = From table1 In db.Table1s

     

     

    Where table1.Language Like Me.ToolStripTextBox1.Text & "*"

     

     

    Order By table1.ID

     

     

    Select table1

     

     

    Me.Table1BindingSource.DataSource = SearchLanguage

     

     

    End Sub


    rh
    Monday, October 4, 2010 7:53 AM

Answers

  • Try the following :

     

     Dim tempDate As DateTime
     tempDate = Convert.ToDateTime(txtInput.Text)
     Dim q = From table1 In db.Tables _
     Where table1.HireDate = tempDate _
     Select table1


     


    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
    • Edited by HabibAhmed Friday, October 8, 2010 9:34 AM minor change
    • Marked as answer by robhare Sunday, October 10, 2010 3:55 PM
    Friday, October 8, 2010 9:32 AM

All replies

  • Try the following :

     

     Dim tempDate As DateTime
     tempDate = Convert.ToDateTime(txtInput.Text)
     Dim q = From table1 In db.Tables _
     Where table1.HireDate = tempDate _
     Select table1


     


    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
    • Edited by HabibAhmed Friday, October 8, 2010 9:34 AM minor change
    • Marked as answer by robhare Sunday, October 10, 2010 3:55 PM
    Friday, October 8, 2010 9:32 AM
  • thanks , but how to write the date. is it in this format '2010/12.15' and is this put into a textbox with a button  to click?
    rh
    Saturday, October 9, 2010 5:13 PM