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

typemismatch on banner exchange.

Status
Not open for further replies.

snowboardr

Programmer
Feb 22, 2002
1,401
PH
Microsoft VBScript runtime error '800a000d'

Type mismatch

/vzio/banner/ad2.asp, line 91

Code:
<html>
<head>
<META NAME=&quot;ROBOTS&quot; CONTENT=&quot;NOINDEX&quot;>
</head>

<BODY BGCOLOR=&quot;&quot; topmargin=&quot;0&quot; leftmargin=&quot;0&quot; bottommargin=&quot;0&quot;>
<% 
	
		'# Declare variables
		Dim ConnString, strSQL
		Dim sMyID, sMyCat

		'# site banner is on
		Dim strOldID, strView, strBank, strSiteCat
		
		'# Selected banner
		Dim strBIMG, strBannerExp, strSiteBank, strSelectedID
		
		'# Settings
		Dim strBannerMinusShown, strSitePlusShown
		 
		'######################################
		ConnString = &quot;dsn=vzio&quot;
		set my_conn= Server.CreateObject(&quot;ADODB.Connection&quot;) 
		'######################################
		my_conn.Open ConnString 
			 
		sMyID = &quot;100004&quot;
		'sMyCat = &quot;100&quot;
		
		
		strSQL = &quot;SELECT * FROM settings WHERE id=1&quot;
		set admin = my_conn.Execute(strSQL)
			strBannerMinusShown = admin(&quot;bannerminus_Shown&quot;) 
			strSitePlusShown = admin(&quot;siteplus_Shown&quot;) 
		set admin = nothing
		

		If Request.QueryString(&quot;BID&quot;) <> &quot;&quot; then sMyID = Request.QueryString(&quot;BID&quot;)
		
		set info = Server.CreateObject(&quot;ADODB.RecordSet&quot;) 
		strSQL = &quot;SELECT * FROM ebanner WHERE bID=&quot; & sMyID
		set info = my_conn.Execute(strSQL) 
		
		'# get last banner shown
		strOldID = info(&quot;old_id&quot;)
		strView = info(&quot;onsite_view&quot;)
		
		'# so we can add +2 for showing a banner
		strBank = info(&quot;bank&quot;)
		
		'# get this sites category
		strSiteCat = info(&quot;sCat&quot;)
		
		set info = nothing
	

							
			
                                set selectabanner = Server.CreateObject(&quot;ADODB.RecordSet&quot;)
                                strSQL = &quot;SELECT * FROM ebanner WHERE bank > 0 AND bCat=&quot; & strSiteCat & &quot; AND bID <> &quot; & sMyID & &quot; AND bID >= &quot; & strOldID & &quot; ORDER BY bID ASC LIMIT 1&quot;
                
                                set selectabanner = my_conn.Execute(strSQL) 

								strSelectedID = selectabanner(&quot;bID&quot;)
								
							'# banner image link
								strBIMG = selectabanner(&quot;banner_img&quot;)
							
							'# so we can add 1 to site exposure
								strBannerExp = selectabanner(&quot;user_exposure&quot;)
					
							'# so we can minus 2
								strSiteBank = selectabanner(&quot;bank&quot;)    
							
								strOLDid = selectabanner(&quot;old_id&quot;)
							
								
								set selectabaner = nothing								
								
       							'# Max ID
                                set maxid = Server.CreateObject(&quot;ADODB.RecordSet&quot;)
                                strSQL = &quot;SELECT bID FROM ebanner WHERE bank > 0 AND bCat=&quot; & strSiteCat & &quot; ORDER BY bID DESC LIMIT 1&quot; 
                
                                set maxid = my_conn.Execute(strSQL) 
								
								strMaxId = maxid(&quot;bID&quot;)
								set maxid = nothing
					
					'# Check max ID
					If strSelectedID = strMaxID or strSelectedID = &quot;&quot; then   '# ERROR HERE LINE 91
								
								 set selectabanner = Server.CreateObject(&quot;ADODB.RecordSet&quot;)
                                strSQL = &quot;SELECT * FROM ebanner WHERE bank > 0 AND bCat=&quot; & strSiteCat & &quot; AND bID <> &quot; & sMyID & &quot; AND bID > 0 ORDER BY bID ASC LIMIT 1&quot;

                                set selectabanner = my_conn.Execute(strSQL)	
										strSelectedID = selectabanner(&quot;bID&quot;)
								
								'# banner image link
									strBIMG = selectabanner(&quot;banner_img&quot;)
								
								'# so we can add 1 to site exposure
									strBannerExp = selectabanner(&quot;user_exposure&quot;)
						
								'# so we can minus 2
									strSiteBank = selectabanner(&quot;bank&quot;)    
								
								 	strOLDid = selectabanner(&quot;old_id&quot;)
									
									set selectabanner = nothing
	
						End if
							
							
							
							'#  update banner shown data
							set updatebanner = Server.CreateObject(&quot;ADODB.RecordSet&quot;)
							strSQL = &quot;UPDATE ebanner SET bank=&quot; & strSiteBank - strBannerMinusShown & &quot;, onsite_exposures=&quot; & strBannerExp + 1  & &quot; WHERE bID=&quot; & strSelecteID
 							Set updatebanner = my_conn.execute(strSql) 

							'# update site account information
							set updatesite = Server.CreateObject(&quot;ADODB.RecordSet&quot;)
							strSQL = &quot;UPDATE ebanner SET bank=&quot; & strSiteBank + strSitePlusShown & &quot;, onsite_view=&quot; & strView + 1 
							Set updatesite = my_conn.execute(strSql)


			%>
<a href=&quot;#&quot;><img src=&quot;<%=strBIMG%>&quot; border=&quot;0&quot;></a> <%=strSelectedID%>
	
</body>
</html>
www.vzio.com
star.gif
/ [wink]
 
Hi there
as you saw in line 91 you have Type mismatch error
because strSelectedID is an Integer and you cann't use
strSelectedID = &quot;&quot;
it means that you are comparing integer with string and
that's why it generates error.
you can use this :
strSelectedID = 0
so ther won't be any error.
TNX
E.T.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top