Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date and Time recording from VB to SQL Server 2000

Status
Not open for further replies.
Jan 3, 2001
66
US
I want to record the date and time, but I will only show the user the date.

I tried the following line as an insert string into SQL and it will not work. It works without the timevalue portion.


lstrUpdateStmt="Insert into CEEmpNearRel(CEENR_EmpNo,CEENR_EffectiveDate) values (N'7183'," & cdate(mskedhiredate.text) & " " & timevalue(now) & ")"
 

Two items of interest:

#1: There is an "N" before your first value '7183', which should not be there or be placed within the single quotes (like 'N7183') and #2: encompass the whole date value with single quotes:

lstrUpdateStmt = "Insert into CEEmpNearRel(CEENR_EmpNo,CEENR_EffectiveDate) values ('7183',[red]'[/red]" & CDate(mskedhiredate.Text) & " " & TimeValue(Now) & "[red]'[/red])"

Mark
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top