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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is this right? ASP Code sending date

Status
Not open for further replies.
Oct 11, 2006
300
US
When I look into the source of my dropdown box, my date looks like this: 4/30/2006

Above is pulled from SQL Server 2005.

Now in my ASP page, I wrote this:

'This line creates an object to reference the 2nd parameter in the report.
'Period is datetime. Hence cast as double of type number 10. (See the chart below)

Set MyParam2 = Session("Param").Item(2)
splitdate = split(Request.form("Period"), "/")
MynewDate1 = splitdate(2) & "/" & splitdate(0) & "/" & splitdate(1) & " 12:00:00 AM"
MyParam2.SetCurrentValue CDate(MynewDate1)

When I run this, my IE browser mentions this error:

Error Type:
Microsoft VBScript runtime (0x800A000D)
Type mismatch
/scripts/ViewReports.asp, line 112

Where line 112 refers to:

MyParam2.SetCurrentValue CDate(MynewDate1)

I even tried this:

MyParam2.SetCurrentValue(CDate(MynewDate1,10))

I get the following error.

Error Type:
Microsoft VBScript runtime (0x800A01C2)
Wrong number of arguments or invalid property assignment: 'CDate'
/scripts/ViewReports.asp, line 113

So what error am I making?

Thanks.
 
Any ideas about this error?

Set MyParam2 = Session("Param").Item(2)
splitdate = split(Request.form("Period"), "/")
MynewDate1 = splitdate(2) & "/" & splitdate(0) & "/" & splitdate(1) & " 12:00:00 AM"
MyParam2.SetCurrentValue CDate(MynewDate1)

I get the error:

Error Type:
Microsoft VBScript runtime (0x800A000D)
Type mismatch
/scripts/testing1/ViewReports1.asp, line 153

Where line 153 is:

MyParam2.SetCurrentValue CDate(MynewDate1)

Thanks.
 
I was getting this error because I was requesting for a form element where the name was written as "Period" instead of "period".

So now I do not get any Date errors.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top