Hello Everyone please help me. I am new to VB and i want to know how to compare the current date with the date stored in the database table?
4 1645 twinnyfo 3,653
Recognized Expert Moderator Specialist
Jayasai,
You need to provide more information for us to help you. Have you tried anything, yet? What types of errors are you getting? We would love to trouble shoot, but we don't have anything to go by.
- Dim date1 As Date
-
Dim DOB As Date
-
Dim sql1 As String
-
-
sql1 = "select DATE_OF_BIRTH from PERSON1 where PERSON_ID=person.personId"
-
Dim command As OracleCommand = New OracleCommand(sql1)
-
'Dim datareader As OracleDataReader = command.ExecuteReader()
-
date1 = Convert.ToDateTime(Today)
-
DOB = command.ExecuteScalar()
-
If Date.Compare(date1, DOB) = 0 Then
-
Dim message As String = "!**Greetings***! Wow Today is Your's Birthday. Wish You A Happy Birthday! Wish you many more returns of the day. Have a lovely day"
-
Dim sb As New System.Text.StringBuilder()
-
sb.Append("<script type='text/javascript'>")
-
sb.Append("window.onload=function(){")
-
sb.Append("alert('")
-
sb.Append(message)
-
sb.Append(" ')};")
-
sb.Append("</script>")
-
ClientScript.RegisterClientScriptBlock(Me.GetType(), "alert", sb.ToString())
-
Else
-
Dim username As String
-
Dim sql2 As String
-
sql2 = "select First_Name from PERSON1 where convert.GETDATE()=DATE_OF_BIRTH "
-
Dim command1 As OracleCommand = New OracleCommand(sql2)
-
'Dim datareader As OracleDataReader = command.ExecuteReader()
-
username = command.ExecuteScalar()
-
Dim message1 As String = "!**Greetings***! Wow Today is " + username + " Birthday and Wish him/her a Happy Birthday!"
-
Dim sb As New System.Text.StringBuilder()
-
sb.Append("<script type='text/javascript'>")
-
sb.Append("window.onload=function(){")
-
sb.Append("alert('")
-
sb.Append(message1)
-
sb.Append(" ')};")
-
sb.Append("</script>")
-
ClientScript.RegisterClientScriptBlock(Me.GetType(), "ClientScript", "alert", sb.ToString())
-
End If
-
I tried this code and i am getting error like this
-
-
-
Invalid operation. The connection is closed.
-
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
-
-
Exception Details: System.InvalidOperationException: Invalid operation. The connection is closed.
-
-
Source Error:
-
-
-
Line 22: 'Dim datareader As OracleDataReader = command.ExecuteReader()
-
Line 23: date1 = Convert.ToDateTime(Today)
-
Line 24: DOB = command.ExecuteScalar()
-
Line 25: If Date.Compare(date1, DOB) = 0 Then
-
Line 26: Dim message As String = "!**Greetings***! Wow Today is Your's Birthday. Wish You A Happy Birthday! Wish you many more returns of the day. Have a lovely day"
twinnyfo,
Thank u for your response
twinnyfo 3,653
Recognized Expert Moderator Specialist
Have you stepped through the code and validated that the connection is still open and that all variables evaluate to what you think they ought to be?
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Gleep |
last post by:
Hey Guys,
I've got a table called Outcomes. With 3 columns and 15 rows
1st col 2nd col 3rdcol
outcome date price
There are 15 rows for each record, each row accounts for a different type of outcome
I'm having trouble with MySQL date comparison. I'm looking for some kind of query that will compare
the all date column and only give me the latest date. Then once I have it, ...
|
by: Phil Powell |
last post by:
The date field I believe is of type datetime, but I'm sorry I have
absolutely no idea how to put today's date into a datetime column
using ASP and SQL Server.
Folks, I'm a LINUX guy!!! This is a project I have to get done today
and that is about the only thing snagging it from being done before
COB today.
Please help.
|
by: Vinnie Davidson |
last post by:
Hello!
I'm trying to get all records from my SQL Server Database with
"DeadlineDate" = today (not today - 24 hours).
All records has a field called "DeadlineDate", and the date is stored in
this field like this: 13.08.2005 07:00:00
I dont care about the hours (Ex: 07:00:00), just the date (ex: 13.08.2005).
This is the SQL I have made, it gets all the record with the date = today -
|
by: Mark |
last post by:
All,
Excuse the re-post but I have found something which works for the UserID
but not for the Password (see previous post below). The problem is I don't
understand how it works and therefore cannot update it to do as I need.
Could someone explain A) how to modify this to make sure the username &
password are valid or B) How the below works so I can do it myself. I have
never seen "PARAMETERS" used before in SQL which has thrown me...
|
by: |
last post by:
I have a datetime field in table.
I want to insert the current time of database server to the table thr
ASP.NET (C#).
I have dataset to do the insert:
DataSet1.TableNameRow rowNew =
(DataSet1.TableNameRow)DataSet1.TableName.NewRow();
rowNew.DateTimeField = System.DateTime.Now;
| |
by: joeyej |
last post by:
How do I compare today's date with this string (in my inc file) so that
I can set an alert if date choice i.e. May 15, 2006 not at least
greater than two days from current date?
<option value="May 15, 2006, (Monday), 10am">May 15, 2006, (Monday),
10am
Thanks,
Joe
|
by: sourabhmca |
last post by:
hi friend,
I am want to insert date with time into sql server2000 using JSP.I hv 3 combo box for dd mm yyyy and 2 text box for hh and min ? and my table field type is smalldatetime.after that i want compare 2 date and want time in hh and min
and display diff time and both date on sql server ?
plz help soon?
|
by: comp21 |
last post by:
Hi,
Now, I have retrieved or imported data from excel spreadsheet to vb6 application. Now I want to compare this part of data with the one already existing in mssql2000 server(table name being same). If some data which is there in excel spread sheet not to be found in mssql2000 server then those data has to be stored in a seperate table in mssql server.
Can anyone please help me with the code....
|
by: parshupooja |
last post by:
Hi ,
I have asp.net page. I have few fields on page , I am inserting value into this fields which are getting saved into SQL server database. I have additional column into the table(SQL Server) named UserId.
along with these field values on the page I want to insert Userid into the Userid olumn. I have Login page where User inserts Userid and Password.
Some suggested to user session variables for that. I don't know anything about...
|
by: TG |
last post by:
hi!
I am trying to create a sql server table from an excel sheet.
Here is the code I have:
'This procedure the xlsx file and dumps it to a table in SQL Server
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |