Forums
This topic is locked
Formatting Form Field Prior to MM Insert Behavior
Posted 23 Jul 2002 17:39:47
1
has voted
23 Jul 2002 17:39:47 Anthony Wilko posted:
I'm trying to enter a military time in the format "1234" into an ASP form which then submits to a SQL Server database. Problem is "1234" is not a recognized time format, so the Insert Behavior of Dreamweaver can't submit the "integer" into the datetime field of SQL Server. It apparently needs to be in "12:34" format. So, I've created the following string to do the conversion: <%= left(sTime, Len(sTime)- 2 ) & ":" & right(sTime, 2) %>. This works fine for converting to a character string that looks like a time, but I can't utilize this formatting with Dreamweaver MX's insert SQL code. Everytime I try to concatenate it into the MM_fieldStr, it chokes. So, does anyone know how I can format a form field prior to getting inserted into an Insert Behavior?
Hope this makes sense...
Tony
Replies
Replied 24 Jul 2002 01:29:06
24 Jul 2002 01:29:06 aegis kleais replied:
What's the exact datatype you're using on SQL?
cause I know that if you use SMALLDATETIME, it wants the date in:
##/##/#### ##:##:## AM/PM format.
ie, 7/23/2002 7:29:23 PM
Anything less makes it bwarf. SQL is so powerful cause it bwarfs bad input. So one can't say "Bad in, gets you bad out" Picky SQL
Aegis Kleais
New Media Web Developer
(DWMX : IIS5.1 : SQL2K : WXP : ASP[VB/JS])
cause I know that if you use SMALLDATETIME, it wants the date in:
##/##/#### ##:##:## AM/PM format.
ie, 7/23/2002 7:29:23 PM
Anything less makes it bwarf. SQL is so powerful cause it bwarfs bad input. So one can't say "Bad in, gets you bad out" Picky SQL
Aegis Kleais
New Media Web Developer
(DWMX : IIS5.1 : SQL2K : WXP : ASP[VB/JS])
Replied 24 Jul 2002 02:08:16
24 Jul 2002 02:08:16 Anthony Wilko replied:
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
What's the exact datatype you're using on SQL?
cause I know that if you use SMALLDATETIME, it wants the date in:
##/##/#### ##:##:## AM/PM format.
ie, 7/23/2002 7:29:23 PM
Anything less makes it bwarf. SQL is so powerful cause it bwarfs bad input. So one can't say "Bad in, gets you bad out" Picky SQL
Aegis Kleais
New Media Web Developer
(DWMX : IIS5.1 : SQL2K : WXP : ASP[VB/JS])
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>
I'm using the straight datetime field. I found the only way around the MM limitation is to build my own INSERT query. I can format in the query I write and get it to do what I want without a problem, but would rather use some of the powerful features of the MM Insert.
I found SQL Server datetime WILL take a time such as "2340". But, if you input "2340" it appears to convert it into the number of days since 1/1/1900. Thus, you'd get something like 5/13/1906 (2340/365 = 6.4 years past 1900). Weird.
Tony Wilko
Infuseweb Design and Hosting
www.infuseweb.com
What's the exact datatype you're using on SQL?
cause I know that if you use SMALLDATETIME, it wants the date in:
##/##/#### ##:##:## AM/PM format.
ie, 7/23/2002 7:29:23 PM
Anything less makes it bwarf. SQL is so powerful cause it bwarfs bad input. So one can't say "Bad in, gets you bad out" Picky SQL
Aegis Kleais
New Media Web Developer
(DWMX : IIS5.1 : SQL2K : WXP : ASP[VB/JS])
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>
I'm using the straight datetime field. I found the only way around the MM limitation is to build my own INSERT query. I can format in the query I write and get it to do what I want without a problem, but would rather use some of the powerful features of the MM Insert.
I found SQL Server datetime WILL take a time such as "2340". But, if you input "2340" it appears to convert it into the number of days since 1/1/1900. Thus, you'd get something like 5/13/1906 (2340/365 = 6.4 years past 1900). Weird.
Tony Wilko
Infuseweb Design and Hosting
www.infuseweb.com