Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


ASP & MS Access

 
Logged in as: Guest
arrSession:exec spGetSession 2,3,2213
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> ASP >> ASP & MS Access
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 ASP & MS Access - 3/2/2005 2:33:44 AM   
  zahid_a

 

Posts: 14
Score: 0
Joined: 2/16/2005
From: Canada
Status: offline
hi....

i have a huge database running on MS Access, and i have ASP doing the search job on the records. one problem i came across is whenever the record in MS Access contains any special character (', ., -) the server just throws me out of the program and returns an error.

i got to know that MS Access does not support searching for the special characters, but is there a way to get around it????

any help will be greatly appreciated...

thanks

_____________________________

zahid
 
 
Post #: 1
 
 Re: ASP & MS Access - 3/2/2005 9:10:08 PM   
  VBS

 

Posts: 110
Score: 0
Joined: 3/2/2005
From: Lebanon
Status: offline
Dear zahid_a,
The only way is to do the following:

1. At the begening of your code put "On Error Resume Next"
2. Above the code that is causeing the error pu this code "Response.Write Err.Number"
3. Run the page
4. you will see a number
5. copy it
6. go back to the script and replace the code "Response.Write Err.Number" with this code "If err.number <> [--the number u copied--] then
[--The code you want to run--]
end if"
7. Run the code

Don't forget to post ur results
and by the way, I personally use this way all the time

Best regards

Firas S Assaad

(in reply to zahid_a)
 
 
Post #: 2
 
 Re: ASP & MS Access - 3/3/2005 5:29:06 AM   
  zahid_a

 

Posts: 14
Score: 0
Joined: 2/16/2005
From: Canada
Status: offline
i tried what u suggested... by inserting the "IF statement" right above the code. since i am using "objCommand" i included the statement right into the "objCommand.Text" & also tried it outside. But in both the cases it throws the server into some unkown process and the memory gets filled up...and eventually i have to restart the web server.

any thoughts on this???

<% OPTION EXPLICIT %>
<!-- #INCLUDE FILE = 'connection.asp' -->
<!-- METADATA TYPE = "typelib"
FILE = "C:\Program Files\Common Files\System\ado\msado15.dll" -->

<HTML>
<HEAD>
<TITLE> TEST </TITLE>
</HEAD>
<BODY>

<%

On Error Resume Next

Dim objRS, objCommand, strFolder, strTemp, strArray

strFolder = Request.Form("FOLDER")

Set objRS = Server.CreateObject("ADODB.Recordset")
objRS.Open "mix", Conn, adOpenForwardOnly, adLockReadOnly, adCmdTable

Set objCommand = Server.CreateObject("ADODB.Command")
objCommand.ActiveConnection = Conn


objCommand.CommandText ="SELECT Folder, SeeAlso, FileSummary, subcontent FROM mix WHERE Folder LIKE '%" & strFolder & "%' ORDER BY Folder"

objCommand.CommandType = adCmdText

Set objRS = objCommand.Execute

strTemp = objRS("folder")


strArray = 0

While Not objRS.EOF

Response.Write "Folder: " & objRS("folder") & "<br>"
strArray = objRS("folder")
Response.Write "See Also: " & objRS("SeeAlso") & "<br>"

Response.Write "Subcontents: "
While objRS("folder") = strArray
Response.Write objRS("subcontent") & "<br>"
objRS.MoveNext
Wend
Response.Write "<br>" & "<br>"
objRS.MoveNext


Wend


objRS.Close
Set objRS = Nothing

Set objCommand = Nothing

%>

</body>
</html>

(in reply to zahid_a)
 
 
Post #: 3
 
 Re: ASP & MS Access - 3/3/2005 6:04:15 AM   
  zahid_a

 

Posts: 14
Score: 0
Joined: 2/16/2005
From: Canada
Status: offline
i found the solution to the problem... the problem was occuring only with the apostrophe(') so i inserted the following line of code:

strFolder = Request.Form("FOLDER")
strFolder = Replace(strFolder, "'", "''")

This would actually let access accept apostrophe as part of the search...
thanks anyways for ur help

(in reply to zahid_a)
 
 
Post #: 4
 
 Re: ASP & MS Access - 3/9/2005 6:35:35 AM   
  VBS

 

Posts: 110
Score: 0
Joined: 3/2/2005
From: Lebanon
Status: offline
Your welcome,
anytime,

if u want further help add me to ur MSN using this email
firasassaad106@hotmail.com

(in reply to zahid_a)
 
 
Post #: 5
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> ASP >> ASP & MS Access Page: [1]
Jump to:





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