Ask a Question related to Dreamweaver AppDev, Design and Development.
-
bthouin #1
Total confusion with data types and VBScript
Hi,
I am fighting a data type mismatch problem, which I didn't have an hour
ago, and which I do not understand at all.
I am using DW MX 2004, VBScript, ASP and SQLServer.
I have a page where the user chooses a month and a year, and from that,
I construct a date in Swiss date format (dd.mm.yyyy) by setting the day
to 01. I.e. if the user chooses "March" and "2005" from 2 list boxes on
the page, I construct "01.03.2005".
I am then using that date to retrieve rows in an SQLServer DB. There,
the corresponding attribute is defined as smalldatetime, and I have to
pass it to the DB as "yyyymmdd", which I do in a function, which thus
"converts" "01.03.2005" to "20050301".
Now my SQL SELECT statement (SELECT * FROM table WHERE myDate =
<variable holding the date defined above>) throws an error, saying that
the statement is not OK, and locates the error as being the date. I
first tried to convert the string to a date with the CDate function, but
that function takes a date as input, stupidly enough (why is it called
"convert" then?). So I added a check on the data type with the VarType
function, and, if the data type is VBstring, then I want to convert the
string to a date with the DataValue function. The code is like this:
if VarType(versionDate) = vbString Then
vDate = DateValue(versionDate)
else
vDate = versionDate
end if
where versionDate is the input I get, and vDate is the variable I want
to use in my SQL SELECT statement.
But the code above throws an error on the 2nd code line !
Microsoft VBScript runtime (0x800A000D)
Type mismatch: 'DateValue'
How in the h... am I supposed to use that input string as a date without
getting either a DB error or a VBScript runtime eroor like that above ????
Thanks for help
Bernard
bthouin Guest
-
passing correct value types from ASP/VBScript to VB/DLL
Hi All, I'm getting an error on my ASP page: Microsoft VBScript runtime error '800a000d' Type mismatch: 'StoreFileIntoField' I assume -... -
schema data types
hi all, i want to know a small clarification. in the schema data types, there are two data types for handling numeric digits.... what is the... -
Total result from datagrid data
Hello, is it somehow possible to calculate the data from the datagrid and display the result somewhere in the footer? Thanks -
Total Confusion! - ACLs and Windows authentication with no impersonation
Hi all, apologies if this has come up before, but I've been searching the whole day and found nothing... If I have authentication set to... -
Fields.value other data types help
Thanks for the answers to my other post. You nailed it, not char data types. How can I iterate through the fields when the fields are int,...



Reply With Quote

