|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
asp sql time format - simple question !?
Working in VBScript ASP page with MSAccess Db.
Well I'm darn embarrased for this to be my first post on here - you know when you've solved all the big stuff and then some tiny stupid little thing sends you flat opn your face ? I want to put a time into my sql statement, like this : INSERT INTO hoursTbl (opening,closing) VALUES ('09:15','17:35') or #09:15#,#17:35# or #9:15:00#,#17:35:00# etc etc.... nearly all of them work if I run them in Access itself, but none are working in my ASP page. I get the standard 'syntax error in INSERT statement' error message Is it a special syntax I need? .. feeling dumb ! Regards |
|
#2
|
||||
|
||||
|
this works
i tested this on my sql server 2000 and it works
<% DIM objConn Set objConn = Server.CreateObject("ADODB.Connection") objConn.ConnectionString = "DSN=database;uid=username;pwd=password" objConn.Open SQLString4 = "INSERT INTO hoursTbl (opening, closing)" SQLString4 = SQLString4 & " VALUES ('09:15','17:35')" objConn.execute(SQLString4) objConn.Close set objConn = Nothing %> hjhjhjhj |
|
#3
|
||||
|
||||
|
also
here is a way you can format your times before you enter them into the database
<% Private Function PMilTime(ByVal dtime) Dim hr,mn hr = Hour(dtime) : mn = Minute(dtime) If Len(hr) = 1 Then hr = 0 & hr If Len(mn) = 1 Then mn = 0 & mn PMilTime = hr & ":" & mn End Function Response.Write PMilTime("1:15 pm") Response.Write "<br>" ' returns 13:15 Response.Write PMilTime("1:15") ' returns 01:15 Response.Write "<br>" Response.Write PMilTime("6:32 pm") ' returns 18:32 Response.Write "<br>" Response.Write PMilTime("1:01") ' returns 01:01 %> |
|
#4
|
|||
|
|||
|
red herring !
Cheers, works fine !
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ASP Programming > asp sql time format - simple question !? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|