Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8777483
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T19:17:22+00:00 2026-06-13T19:17:22+00:00

Dim con1 As OleDb.OleDbConnection Dim cmd As OleDb.OleDbCommand Dim query As String Dim rs

  • 0
 Dim con1 As OleDb.OleDbConnection
            Dim cmd As OleDb.OleDbCommand
            Dim query As String


            Dim rs As OleDb.OleDbDataReader
            con1 = New OleDb.OleDbConnection("Provider=MSDAORA.1;Data Source=localhost;Persist Security Info=True;Password=sys;User ID=nitishok")
            con1.Open()


            query = "select * from HOLDERSDB where DOB like '" + DateTimePicker1.Value + "' "
            cmd = New OleDb.OleDbCommand(query, con1)
            cmd.CommandType = CommandType.Text
            rs = cmd.ExecuteReader

            Dim da As New OleDb.OleDbDataAdapter(query, con1)

            Dim ds As New DataSet()
            da.Fill(ds, "HOLDERSDB")
            DataGridView1.DataSource = ds.Tables(0)

            con1.Close()
    enter code here

i want rows from HOLDERS table that have DOB as datetimepicker1
The code that i have posted does not return any results.

Plz help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T19:17:23+00:00Added an answer on June 13, 2026 at 7:17 pm

    assuming DOB is a DATE field (hopefully it is!)
    then use TO_DATE and don’t try to compare date=string, otherwise your code will fail if not today then someday.

    "select * from HOLDERSDB where dob = to_date(" + DateTimePicker1.Value + ", 'dd-mon-yyyy')
    

    see here to format the return of DateTimePicker

    http://msdn.microsoft.com/en-us/library/system.windows.forms.datetimepicker.customformat.aspx

    make sure to format it the same way as the 2nd parameter (doesnt have to be dd-mon-yyyy as i put, Oracle supports multiple formats) in the TO_DATE function.

    also you should be using bind variables and not pasting strings into the SQL anyway for performance / security reasons.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Dim conn As OleDbConnection Dim cmd As OleDbCommand Public Sub openDB() conn = New
Dim con As New OleDb.OleDbConnection Sub connecttodatabase(ByVal fileselected As String) Dim databasepassword con.ConnectionString =
Dim Cnxn As ADODB.Connection Set Cnxn = New ADODB.Connection With Cnxn .Provider = MSDataShape
Dim usersInRole As String() = Roles.GetUsersInRole(HR_Base_Role) Dim Myusers As New MembershipUserCollection For Each UserName
Dim myDelims As String() = New String() {<beginning of record>} Dim split1 As String()
Dim dataContext As New ACSLostFoundEntities() Dim query = From s In dataContext.FosterForms() _ Join
Dim obj_DataTable As New System.Data.DataTable(Category) Dim obj_DataSet As New DataSet() 'Declaring the array of
Dim x = GetType(List(Of )) 'valid statement Dim list As New List(Of String) Now
Dim command_sbsp As New OleDbCommand(SELECT * FROM SNOMED_ORG_INFO WHERE ConceptID=@ID AND Genus='SALMONELLA' AND SubSpecies=@Subsp,
Dim goodCustObjList As New List(Of CustomerObj) goodCustObjList = DataBLLModule.GetCustomerRecordList(String.Empty) Dim custList = From t

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.