|
 |
asp_databases thread: 0x80020005 type mismatch
Message #1 by "Ender Wiggin" <mazthe@y...> on Thu, 15 Nov 2001 02:50:32
|
|
Hi guys and gals,
This is going to be tricky to explain so I'm including some numbered lines
of code.
1 'parse the form values - to be written to the timesheet table
2 start = Request.Form("date") & " " & Request.Form("starth") & ":"
& Request.Form("startm")
3 finish = Request.Form("date") & " " & Request.Form("finishh")
& ":" & Request.Form("finishm")
4 break = (Request.Form("breakh")* 60) + Request.Form("breakm")
5 'update table Timesheet with values
6 rsDocs("startTime") = start
7 rsDocs("finishTime") = finish
8 rsDocs("breaksMins") = break
9 rsDocs.Update
10 rsDocs.Close
11 Set rsDocs = Nothing
12
13 If Request.Form("Calc") <> "" Then
14 Response.Redirect "addTimesheet.asp"
15 Else ' addNew
16 Response.Redirect "viewTimesheet.asp"
17 End If
This is part of a timesheet application.
The form values in this code are concatonated and stored in variables -
lines 2-4
and then written to the db in lines 6-8
Once this is done the user is either redirected to the current
page "addTimeshee.asp"
or redirected to another page according to the submitted value - lines 13
to 17.
So the code deals with Calc or addNew in the same way.
The code is working fine with addNew - updates the db and redirects to
viewTimesheet.asp
However when I select Calc on the preceding form, it gives the following
error message
Provider (0x80020005)
Type mismatch.
/begASP/addTimesheet.asp, line 6 - rsDocs("startTime") = start
The weird thing is that it is actually updating the db with the correct
values.
Anyone got any ideas? Any help would be much appriciated.
Message #2 by "Ken Schaefer" <ken@a...> on Thu, 15 Nov 2001 14:07:13 +1100
|
|
How about attempting to Cast the variable as a date subtype?
If isDate(start) then
objRS("startTime") = CDate(start)
Else
Response.Write("Houston, we have a problem!")
Response.End
End If
Cheers
Ken
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "Ender Wiggin" <mazthe@y...>
Subject: [asp_databases] 0x80020005 type mismatch
: Hi guys and gals,
:
: This is going to be tricky to explain so I'm including some numbered lines
: of code.
:
: 1 'parse the form values - to be written to the timesheet table
: 2 start = Request.Form("date") & " " & Request.Form("starth") & ":"
: & Request.Form("startm")
: 3 finish = Request.Form("date") & " " & Request.Form("finishh")
: & ":" & Request.Form("finishm")
: 4 break = (Request.Form("breakh")* 60) + Request.Form("breakm")
: 5 'update table Timesheet with values
: 6 rsDocs("startTime") = start
: 7 rsDocs("finishTime") = finish
: 8 rsDocs("breaksMins") = break
: 9 rsDocs.Update
: 10 rsDocs.Close
: 11 Set rsDocs = Nothing
: 12
: 13 If Request.Form("Calc") <> "" Then
: 14 Response.Redirect "addTimesheet.asp"
: 15 Else ' addNew
: 16 Response.Redirect "viewTimesheet.asp"
: 17 End If
:
: This is part of a timesheet application.
:
: The form values in this code are concatonated and stored in variables -
: lines 2-4
: and then written to the db in lines 6-8
:
: Once this is done the user is either redirected to the current
: page "addTimeshee.asp"
: or redirected to another page according to the submitted value - lines 13
: to 17.
:
: So the code deals with Calc or addNew in the same way.
:
: The code is working fine with addNew - updates the db and redirects to
: viewTimesheet.asp
:
: However when I select Calc on the preceding form, it gives the following
: error message
:
: Provider (0x80020005)
: Type mismatch.
: /begASP/addTimesheet.asp, line 6 - rsDocs("startTime") = start
:
: The weird thing is that it is actually updating the db with the correct
: values.
:
: Anyone got any ideas? Any help would be much appriciated.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Message #3 by "Tomm Matthis" <matthis@b...> on Thu, 15 Nov 2001 06:32:49 -0500
|
|
In ASP all variables are of type variant. Try casting the start, finish, break
to CDate()
As in: rsDocs("startTime") = CDate(start)
HTHs,
-- Tomm
P.S. How goes battle school Ender? <grin>
> -----Original Message-----
> From: Ender Wiggin [mailto:mazthe@y...]
> Sent: Thursday, November 15, 2001 2:51 AM
> To: ASP Databases
> Subject: [asp_databases] 0x80020005 type mismatch
>
>
> Hi guys and gals,
>
> This is going to be tricky to explain so I'm including some numbered lines
> of code.
>
> 1 'parse the form values - to be written to the timesheet table
> 2 start = Request.Form("date") & " " & Request.Form("starth") & ":"
> & Request.Form("startm")
> 3 finish = Request.Form("date") & " " & Request.Form("finishh")
> & ":" & Request.Form("finishm")
> 4 break = (Request.Form("breakh")* 60) + Request.Form("breakm")
> 5 'update table Timesheet with values
> 6 rsDocs("startTime") = start
> 7 rsDocs("finishTime") = finish
> 8 rsDocs("breaksMins") = break
> 9 rsDocs.Update
> 10 rsDocs.Close
> 11 Set rsDocs = Nothing
> 12
> 13 If Request.Form("Calc") <> "" Then
> 14 Response.Redirect "addTimesheet.asp"
> 15 Else ' addNew
> 16 Response.Redirect "viewTimesheet.asp"
> 17 End If
>
> This is part of a timesheet application.
>
> The form values in this code are concatonated and stored in variables -
> lines 2-4
> and then written to the db in lines 6-8
>
> Once this is done the user is either redirected to the current
> page "addTimeshee.asp"
> or redirected to another page according to the submitted value - lines 13
> to 17.
>
> So the code deals with Calc or addNew in the same way.
>
> The code is working fine with addNew - updates the db and redirects to
> viewTimesheet.asp
>
> However when I select Calc on the preceding form, it gives the following
> error message
>
> Provider (0x80020005)
> Type mismatch.
> /begASP/addTimesheet.asp, line 6 - rsDocs("startTime") = start
>
> The weird thing is that it is actually updating the db with the correct
> values.
>
> Anyone got any ideas? Any help would be much appriciated.
>
> $subst('Email.Unsub')
>
Message #4 by "Ender Wiggin" <mazthe@y...> on Mon, 19 Nov 2001 00:21:05
|
|
Thanks for the suggestions. I didnt know about the cDate function so
thats useful.
The problem with my code was something different though. The error
message confused me and I was looking in the wrong place for the
solution. I decided to create a flow diagram to help with the logic and
it turns out I was redirecting to the wrong page.
I still dont understand why I was getting that particular error message.
Without the call to the (wrong) page it was updating the table fine, so
there was no "type mismatch". (???)
ps. Just hanging with the hive queen Tomm
Message #5 by "Tomm Matthis" <matthis@b...> on Mon, 19 Nov 2001 08:02:17 -0500
|
|
Glad to hear you figured it out. Maybe something was "stepping" on the var
somewhere along the line?
-- Tomm
> -----Original Message-----
> From: Ender Wiggin [mailto:mazthe@y...]
> Sent: Monday, November 19, 2001 12:21 AM
> To: ASP Databases
> Subject: [asp_databases] Re: 0x80020005 type mismatch
>
>
> Thanks for the suggestions. I didnt know about the cDate function so
> thats useful.
>
> The problem with my code was something different though. The error
> message confused me and I was looking in the wrong place for the
> solution. I decided to create a flow diagram to help with the logic and
> it turns out I was redirecting to the wrong page.
>
> I still dont understand why I was getting that particular error message.
> Without the call to the (wrong) page it was updating the table fine, so
> there was no "type mismatch". (???)
>
>
> ps. Just hanging with the hive queen Tomm
>
> $subst('Email.Unsub')
>
>
|
|
 |