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

Need help debugging this error

Status
Not open for further replies.

Maximus007

Technical User
Jul 26, 2004
248
0
0
US
I would like to accomplish the following:

I have a form that has several drop down menus that
Populates data from a database. Now toward the end I have
added a little calculation to form. Here what I am hoping to
accomplish: as the user select data from the drop down menu
depending on the selection that was made before hitting the
submit button it does the calculation and displays it on the form.
I am not sure if it's the calculation that is wrong or something simple
I left out. Please let me know what I can do to accomplish this goal

Thank you

The error is Type mismatch: '[string: "0.10.20.30.4"]'

<%

Dim strService
Dim strDelinquent
Dim strPromos
Dim strCus_Com
Dim strNT_Login
dim strDuration

strService= Request.form("Service")
strDelinquent= Request.form("Delinquent")
strDuration= Request.form("Duration")
strPromos= Request.form("Promos")
%>
<%
Dim DcDuration, rsDuration
StrDuration= " "

set dcDuration=Server.CreateObject("ADODB.CONNECTION")
dcDuration.Open "Provider=sqloledb;Data Source=Flmirsql02;Initial Catalog=Retention;User Id=Retention_Tool;Password=password;"

Set rsDuration = Server.CreateObject("ADODB.Recordset")
rsDuration.open "CviDuration", dcDuration
%>
<%
Dim DcDelinquent, rsDelinquent
StrDelinquent = " "

set dcDelinquent=Server.CreateObject("ADODB.CONNECTION")
dcDelinquent.Open "Provider=sqloledb;Data Source=Flmirsql02;Initial Catalog=Retention;User Id=Retention_Tool;Password=password;"

Set rsDelinquent = Server.CreateObject("ADODB.Recordset")
rsDelinquent.open "CviDelinquent", dcDelinquent


%>
<%
Dim DcPromos, rsPromos
StrPromos = " "

set dcPromos=Server.CreateObject("ADODB.CONNECTION")
dcPromos.Open "Provider=sqloledb;Data Source=Flmirsql02;Initial Catalog=Retention;User Id=Retention_Tool;Password=password;"

Set rsPromos = Server.CreateObject("ADODB.Recordset")
rsPromos.open "CviPromos", dcPromos

%>
</head>
<body>

<form method="post" action="Rt_Updated_Successfully.asp" onsubmit="return FrontPage_Form1_Validator(this)" name="FrontPage_Form1" language="JavaScript">
<div align="center">

<%
StrService = "0.4"
StrDelinquent = "0.3"
StrDuration = "0.2"
StrPromos = "0.1"

Select case cstr(strService)

Case "Internet/Digi"

strService= strService * 4

Case "Internet/Vid"

strService = StrService * 3

Case "Internet Only"

strService = StrService * 2

Case "Digital"

strService = StrService * 2

Case "B2"

strService = strService * 1

Case "B1"

strService = StrService * 0

End Select

Select case cstr(StrDuration)

Case "3 or more Years"

strDuration = strDuration * 4

Case "1 to 2 years"

strDuration = strDuration * 2

Case "Less than a year"

strDuration = strDuration * 1

End Select



Select Case cstr(StrDelinquent)

Case "0"

strDelinquent = strDelinquent * 4

Case "1-3"

strDelinquent = strDelinquent * 2


Case "4-6"

strDelinquent = strDelinquent * 1

End Select

Select Case cstr(StrPromos)

Case "No Promos"

strPromos = strPromos * 4

Case "Promo w/ 1 year"

strPromos = strPromos * 2

Case "Promo within 6 months"

strPromos = strPromos * 1

End Select
Dim CviTotal


CviTotal= " "


CviTotal= (strPromos + strDuration + strDelinquent + strService)



'Response.write (CviTotal)

If CviTotal >= 3 Then

Response.Write "High"

Elseif CviTotal >= 2.5 Then

Response.Write "Medium"

Elseif CviTotal >= 0 Then

Response.Write "Low"

End if


%></td>
</tr>
</table>
<table border="0" style="border-collapse: collapse" width="94%" id="table12" cellpadding="0">
<tr>
<td width="477">
<p align="right;
Highest level of service on current bill?&nbsp;&nbsp; </font> </td>
<td>
<p align="left">
<span style="vertical-align: middle">
<font face="Arial">
<!--webbot bot="Validation" s-display-name="Choose a Service Level" b-value-required="TRUE" b-disallow-first-item="TRUE" --><SELECT name="Service" size="1">
<option value="Choose A Service Level." selected>Choose A Service Level.</option>
<%
Do while not rsService.EOF

Response.Write "<Option =" & rsService("CviServiceID")
Response.Write ">" & rsService("CviServiceName_Serv")

rsService.MoveNext
loop

rsService.Close
set rsService = Nothing

dcService.Close

set dcService = Nothing
%>

</SELECT></font></span></td>
</tr>
</table>
<table border="0" style="border-collapse: collapse" width="81%" id="table9" cellpadding="0">
<tr>
<td width="413">
<p align="right"><font face="Arial" size="2">How long has the
customer been a subscriber at the current address?&nbsp;&nbsp; </font> </td>
<td><span style="vertical-align: middle">
<font face="Arial">
<!--webbot bot="Validation" s-display-name="Choose a Time Frame" b-value-required="TRUE" b-disallow-first-item="TRUE" --><SELECT name="Duration" size="1">
<option value="Choose A Time Frame." selected>Choose A Time Frame.</option>

<%
Do while not rsDuration.EOF

Response.Write "<Option =" & rsDuration("CviDurationID")
Response.Write ">" & rsDuration("CviDurationName_Dur")

rsDuration.MoveNext
loop

rsDuration.Close
set rsDuration = Nothing

dcDuration.Close

set dcDuration = Nothing
%>

</SELECT></font></span></td>
</tr>
</table>
<table border="0" style="border-collapse: collapse" width="99%" id="table10" cellpadding="0">
<tr>
<td width="501">
<p align="center"><font face="Arial" size="2">How many times has
the customer been in the red for delinquency in the past 6 mo?</font></td>
<td><span style="vertical-align: middle">
<font face="Arial">
<!--webbot bot="Validation" s-display-name="Choose a Time Frame" b-value-required="TRUE" b-disallow-first-item="TRUE" --><SELECT name="Delinquent" size="1">
<option value="Choose A Time Frame. " selected>Choose A Time Frame.</option>
<%
Do while not rsDelinquent.EOF

Response.Write "<Option =" & rsDelinquent("CviDelinquentID")
Response.Write ">" & rsDelinquent("CviDelinquentName_Del")

rsDelinquent.MoveNext
loop

rsDelinquent.Close
set rsDelinquent = Nothing

dcDelinquent.Close

set dcDelinquent = Nothing
%>



</SELECT></font></span></td>
</tr>
</table>
<table border="0" style="border-collapse: collapse" width="80%" id="table11" cellpadding="0">
<tr>
<td width="407">
<p align="right"><font face="Arial" size="2">Has the customer had promotional offer in the
past 1 year?&nbsp;&nbsp; </font></td>
<td><span style="vertical-align: middle">
<font face="Arial">
<!--webbot bot="Validation" s-display-name="Choose one" b-value-required="TRUE" b-disallow-first-item="TRUE" --><SELECT name="Promos" size="1">
<option value="Choose one!" selected>Choose one!</option>

<%
Do while not rsPromos.EOF

Response.Write "<Option =" & rsPromos("CviPromosID")
Response.Write ">" & rsPromos("CviPromosName_Pr")

rsPromos.MoveNext
loop

rsPromos.Close
set rsPromos = Nothing

dcPromos.Close

set dcPromos= Nothing
%>



</SELECT></font></span></td>

 
Your posting is long and it is late, but the only calculation I see is
Code:
CviTotal= (strPromos + strDuration + strDelinquent + strService)
and that occurs in server-side script - long before the user can make a selection. If you want your calculation to occur as a result of something the user does before he submits the form, it must be done in client-side scrpt.
 
Why don't you provide the line # of the error so we can find out where the error is being triggered.

ToddWW
 
I think the problem is that you are declaring a string on this line and then

StrService = "0.4"
StrDelinquent = "0.3"
StrDuration = "0.2"
StrPromos = "0.1"

and then you are using it to do the calculation

strService= strService * 4

Now in order for you to have the same data type you can do this...

strService= cint(strService) * 4

This will change the string into integre type.

HTH...

 
Molaker is righ!

I need to perform the calculation on the client side and not the server side. Well I need some reference on Java script. Does anyone knows of some good sites I can visit to help me accomplish my goal?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top