Hello Friends,

I need to develop a birthday reminder form in my project....

The list of all patient that are celebrating birthday on that particular day and month...leaving the year....

My database is SQL server and I have used date datatype for it....

So I can I get the month and the day from the query and show the list of patient celebrating birthday in a datagrid.....

For anyone who might need it

'Open connection
            Dim myCommand As SqlCommand
            myCommand = New SqlCommand("SELECT * FROM tablename where Day(BirthDate)='" + Date.Now.Day.ToString + "' and Month(Birthdate) = '" + Date.Now.Month.ToString + "'", Connection)
            Dim reader As SqlDataReader = myCommand.ExecuteReader
            Dim bool As Boolean
            bool = reader.Read
            If bool = False Then
                MsgBox("Invalid details")
                Dim dt As New DataTable
                With DataGridView1
                    .AutoGenerateColumns = True
                    .DataSource = dt
                End With
            End If
        Catch ex As Exception
            MsgBox("Error Connecting to Database: " & ex.Message)
        End Try
close connection
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.