a webmaster learning community
     Home    Register     Search      Help      Login    
FrontPage Alternative
Sponsors

Hosting from $3.99 per month!

Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions. dd

Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

Search Forums
 

Advanced search
Recent Posts

 Todays Posts
 Most Active posts
 Posts since last visit
 My Recent Posts
 Mark posts read

 

RE: Type mismatch error

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> ASP and Database >> RE: Type mismatch error
Page: <<   < prev  1 [2]
 
rrnml

 

Posts: 197
Joined: 9/20/2004
Status: offline

 
RE: Type mismatch error - 5/18/2005 12:48:21   
Ok for some reason it wasn't working, but it is now. Well part of it is. It works when I enter a keyword. It will display records for that, but when I select a user it displays no records. The user name that is in the database is NMLW2K/username. And this is what I get when I try to search by user.....





2005050220050518joseph select DISTINCT DestHost, ClientUserName from WebProxyLog where (logDate between '20050502' and '20050518') AND (ClientUserName like '%joseph')

No records in recordset! 




I imagine the wildcard % would pick up the NMLW2K part right?

(in reply to rrnml)
rrnml

 

Posts: 197
Joined: 9/20/2004
Status: offline

 
RE: Type mismatch error - 5/18/2005 13:42:38   
Ok so I just answered my own question. It did not pick up the NMLW2K part. So I had to add that to my table of users. Only now on the drop down list it shows all the users with NMLW2K. Don't want that. So I tried to substr it out on the form and I'm getting this error.






Microsoft OLE DB Provider for ODBC Drivers
error '80040e14'
[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'Substr(Employee.InOut.Name,1,7) Name'.
/Queries/InternetDestinationsForm3.asp, line 49

Any idea on that?

Here is the code for the form.


<html xmlns:mso="urn:schemas-microsoft-com:office:office" xmlns:msdt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882">
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>Internet Destinations </title>
<!--[if gte mso 9]><xml>
<mso:CustomDocumentProperties>
<mso:Approval_x0020_Level msdt:dt="string"></mso:Approval_x0020_Level>
<mso:Categories msdt:dt="string"></mso:Categories>
<mso:Assigned_x0020_To msdt:dt="string"></mso:Assigned_x0020_To>
<mso:Assigned_x005f_x0020_To msdt:dt="string"></mso:Assigned_x005f_x0020_To><mso:Approval_x005f_x0020_Level msdt:dt="string"></mso:Approval_x005f_x0020_Level></mso:CustomDocumentProperties>
</xml><![endif]-->
<meta name="Microsoft Border" content="b, default">
</head>
<body>
<%
Dim con 
Dim rst
Dim strSQL
Dim strParm1
Dim strParm2

Const adOpenKeyset = 0
Const adLockOptimistic = 1
'Create the objects 
Set con = Server.CreateObject("ADODB.Connection") 
Set rst = Server.CreateObject("ADODB.Recordset") 

' Open the connection to the Employee In or Out Database
con.Open "InOut2", "", ""

' Create the SQL Query String
' Employee Query String
strSQL = " select Substr(Employee.InOut.Name,1,7) Name" & _
        " from InOut Order by Name "
Set rst = Server.CreateObject("ADODB.Recordset")
rst.Open strSQL, con, adOpenKeyset, adLockOptimistic 
%>
<p align="center">
<font face="Verdana" size="4">Internet Destinations</font></p>
<p align="center">
&nbsp;</p>
<table border="0" width="100%">
 <tr>
   <td width="100%">
     <table border="0" width="100%">
       <tr>
         <td width="50%"><font face="Verdana" size="2">Select the From Date</font>
         </td>
         <td width="50%"><font face="Verdana" size="2">Select the Thru Date</font>
         </td>
       </tr>
       <tr>
         <td width="50%">
<object classid="clsid:8E27C92B-1264-101C-8A2F-040224009C02" id="Calendar1" width="334" height="192">
 <param name="_Version" value="458752">
 <param name="_ExtentX" value="6519">
 <param name="_ExtentY" value="4064">
 <param name="_StockProps" value="1">
 <param name="BackColor" value="-2147483633">
 <param name="Year" value="2000">
 <param name="Month" value="1">
 <param name="Day" value="7">
 <param name="DayFontColor" value="0">
 <param name="DayLength" value="1">
 <param name="FirstDay" value="1">
 <param name="GridCellEffect" value="1">
 <param name="GridFontColor" value="10485760">
 <param name="GridLinesColor" value="-2147483632">
 <param name="MonthLength" value="2">
 <param name="ShowDateSelectors" value="-1">
 <param name="ShowDays" value="-1">
 <param name="ShowHorizontalGrid" value="-1">
 <param name="ShowTitle" value="-1">
 <param name="ShowVerticalGrid" value="-1">
 <param name="TitleFontColor" value="10485760">
 <param name="ValueIsNull" value="0">
</object>
         </td>
         <td width="50%">
<object classid="clsid:8E27C92B-1264-101C-8A2F-040224009C02" id="Calendar2" width="337" height="192">
 <param name="_Version" value="458752">
 <param name="_ExtentX" value="6519">
 <param name="_ExtentY" value="4064">
 <param name="_StockProps" value="1">
 <param name="BackColor" value="-2147483633">
 <param name="Year" value="2000">
 <param name="Month" value="1">
 <param name="Day" value="7">
 <param name="DayFontColor" value="0">
 <param name="DayLength" value="1">
 <param name="FirstDay" value="1">
 <param name="GridCellEffect" value="1">
 <param name="GridFontColor" value="10485760">
 <param name="GridLinesColor" value="-2147483632">
 <param name="MonthLength" value="2">
 <param name="ShowDateSelectors" value="-1">
 <param name="ShowDays" value="-1">
 <param name="ShowHorizontalGrid" value="-1">
 <param name="ShowTitle" value="-1">
 <param name="ShowVerticalGrid" value="-1">
 <param name="TitleFontColor" value="10485760">
 <param name="ValueIsNull" value="0">
</object>
         </td>
       </tr>
     </table>
   </td>
 </tr>
</table>
  
<form method="POST" action="InternetDestinations3.asp" name="SendDates" target="_blank">
<table width="290" border="1" align="center">
<tr><td align="center" width="280">Search by keyword or phrase</td></tr>
<tr><td align="center" width="280"><input type="text" name="searchterm" size="20">
  <p><input type="submit" value="Search" name="B1"><input type="reset" value="Reset" name="B2"></p>
<input type="hidden" name="fdate"><input type="hidden" name="tdate">
</td></tr></table>
 
<table width="290" border="1" align="center">
<tr><td align="center" width="280">Search by user</td></tr>
<tr><td align="center" width="280"> 
       <p> <select size="1" name="scname">
<%
' Only display records if there are records in the recordset
If NOT rst.EOF then
'Loop through the recordset until ther are no more records
Do While Not rst.EOF
%>        <option value="<%=rst("Name")%>"><%=rst("Name")%></option>
<% 
'If you forget this next statement, you will be stuck in a loop
rst.MoveNext
Loop
Else
%>        <option value="Error">No records Found</option>
<%
End If

rst.Close
%>     
  <p><input type="submit" value="Search" name="B1"><input type="reset" value="Reset" name="B2">
       </select></p>
       <p> &nbsp;</p>
    </td></tr></table> </form>

<script language=vbscript>
Calendar1.Value = Now()
Calendar2.Value = Now()
call setFromDate
call setThruDate
Sub setFromDate
Dim month, day
If Calendar1.Month < 10 then
 month = "0" & Calendar1.Month
Else
 month = Calendar1.Month
End If
If Calendar1.Day < 10 then
 day = "0" & Calendar1.Day
Else
 day = Calendar1.Day
End If
document.SendDates.fdate.value = Calendar1.Year & month & day
End Sub

Sub Calendar1_click
 call setFromDate
 If document.SendDates.tdate.value < document.SendDates.fdate.value then
   call window.alert("The Thru Date must be greater than or equal to the From Date.  The Thru Date will be reset to match the From Date.")
   Calendar2.Value = Calendar1.Value
   call setThruDate
End If
 
End Sub

Sub setThruDate
Dim month, day
If Calendar2.Month < 10 then
 month = "0" & Calendar2.Month
Else
 month = Calendar2.Month
End If
If Calendar2.Day < 10 then
 day = "0" & Calendar2.Day
Else
 day = Calendar2.Day
End If
document.SendDates.tdate.value = Calendar2.Year & month & day
End Sub

Sub Calendar2_click
call setThruDate
If document.SendDates.tdate.value < document.SendDates.fdate.value then
 call window.alert("The Thru Date must be greater than or equal to the From Date.  The Thru Date will be reset to match the From Date.")
 Calendar2.Value = Calendar1.Value
 call setThruDate
End If
End Sub

</script>
</body>



(in reply to rrnml)
BeTheBall

 

Posts: 6385
Joined: 6/21/2002
From: West Point Utah USA
Status: offline

 
RE: Type mismatch error - 5/18/2005 14:28:49   
Something like this:

<option value="<%=rst("Name")%>"><%=Right(rst("Name"),Len(rst("Name"))-7)%></option>

Also, rather than add NMLW2K/ to your table, you could have changed this line:

strSQLWhere = " AND  (ClientUserName like '%" & strUser & "')  "

to

strSQLWhere = " AND  (ClientUserName like '%" & strUser & "%')  "




_____________________________

Duane

Some people are like Slinkies . . . Not really good for anything . . . . . But they still bring a smile to your face when you push them down a flight of stairs.

(in reply to rrnml)
rrnml

 

Posts: 197
Joined: 9/20/2004
Status: offline

 
RE: Type mismatch error - 5/18/2005 14:52:08   
Ok I tried that and it gives me an Invalid use of NULL error. So I tried your other suggestion and that worked. Thanks so much. You guys are great.

(in reply to BeTheBall)
Page:   <<   < prev  1 [2]
OutFront Discoveries

All Forums >> Web Development >> ASP and Database >> RE: Type mismatch error
Page: <<   < prev  1 [2]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts