Find And Replace & For Sql Statment
i have a qs variable that has a & and i need to query the db, what do i replace the & with to query my data correctly?
View Repliesi have a qs variable that has a & and i need to query the db, what do i replace the & with to query my data correctly?
View RepliesI am not sure if this is a question for this forum or the IIS forum but here goes. I have a dedicated server on which I am hosting about 80 websites at the moment, all of which have been created by copying a template site. All of these sites have an identical structure and are located in the same directory on the server, C:Inetpubvhosts. Several times when I have needed to make an adjustment to the sites I have to go into the remote desktop connection to the server and go site by site, copying and pasting files. For example, as each site has the same pages, ie., map.asp, sometimes I make a change to that page and have to copy it to every site. Could I write some sort of script using the FSO and execute it from one site and have it loop through each site on the server making the neccessary change(s)?
View Replies View RelatedI'm working on something at the moment which pulls through a url to another page if it exists. I've got that bit working.
The bit I don't know how to do (real asp beginner here) is to check if the url has http:// in it, and if it has, remove it.
currently i'm working on a template-system. variables can be used in the form of {variable} and there even are some functions available like: [if(condition, statement-if-true, statement-if-false)]
this all relies on regular expressions. to find and replace the variables i use the following snippet:
set reo = new regexp
with reo
.pattern = "{.*}"
.ignorecase = true
.global = true
end with
I am new to reg expressions and would like to write a regex for a .html page I am working. I want the regex to find every http link (<a href= ) that contains .org. Once it finds every link that contains .org I want to then remove ( exit.asp?url= ) that precedes it as well as add the attribute ( target="_blank" ) to the (<a href=) tag.
This basically will find all instances where I am calling my .asp page that lets the user know they are exiting the main site for an outside source and eliminate this page as long as the link they are clicking is within the original site. Otherwise I call my exit.asp page which notifies the user they are leaving.
Example:
Look for this type of tag (one where the link contains .org):
<a href="exit.asp?url=http://myorgwebsite.org/myorg"> Link 1</a>
Replace with this (removes the "exit.asp?url=", but adds target="_blank" attribute):
<a href="http://myorgwebsite.org/myorg" target="_blank"> Link 1</a>
A new client gave me a .prn file to convert to an Access .mdb file for use on his site. Don't ask why, but he insists this is how he delivered updates to his previous source. The conversion was mostly successful, but I ended up with a lot of stray asterisks (*) mixed in with the text in a lot of the records.
I tried to do a simple find and replace, but the * character is, of course, a wildcard character. When I tried to search for it, Access returned everything as a result. There's thousands of records, so obviously I don't want to do this by hand.
Even coding an .asp page to update the records seems like more work than this problem warrants. I'll probably export to a .txt file and do a find and replace there and then re-import, but I'm curious if anyone else has had this problem. Is there an easy way to search for (and replace) the asterisk character in an Access file?
If I replace "a" with "b", and then I replace "b" with "a", shouldn't I get the same result? That is what I am trying to encode and decode with Replace() function, but it is giving me different things when I replace and replace again. Here is what I am talking about: Code:
View Replies View Relatedi need help with this simple IF then statment.
i want to do this
Code:
IF
response.write objrs ("ok2show") = y
THEN
<img src="http://auditors.demosales.netauditimages<%Response.Write objRS("cnum") %>.bmp" alt="Demonstrator" width="800" height="600"border="7" >
ELSE
<img src="http://auditors.demosales.netauditimagesdefaultimage.jp g"
it's not working it's getting hung up at the response.write objrs part.
I have an sql statment with an in statment for ID . I'm trying to get the CompanyID in ( ) but all i get is just the word companyID with no value . i used response.write request.form("companyID") so i know the value is coming to the other page, this is what i have now.
Response.Write ("& CompanyID & ")
and this is what i see
& CompanyID &
how do i get the value of companyID in ().
what is missing fromt his sql statment its for an asp page that displays a list of results?
rs.Open "SELECT * FROM downtime WHERE downtime.Entrydate = #" & mediumdate&"# AND Supervisors_name<>"none"", conn,1
i get a message saying expected end of statment and it worked up until i added the AND Supervisors_name<>"none" in to the statment?
I am trying to pass a variable from another page to a sql statment. The variable specifies the one of the columns that I want the sql query to return. I also want to display field contents of the column later in my page. I can't seem to get this to work. Can someone give me a hand? Here is my code:
View Replies View Relatedi have this variable:
name="Jones, andrew"
when i update the table it gives an error
here is my update code:
str= "UPDATE tblnames SET Name = '" & name & "' WHERE Id ='" & getid & "'"
can someone tell me whats wrong with it because the name variable has a comma in it.
I'm not an hardcore programmer but i try to do a simple search in my asp pages.
I've a database .
I've try this code:
rs.Open "SELECT titre , sstitre , carac , gastro , historique , cepage FROM catalogue WHERE titre , sstitre , carac , gastro , historique , cepage LIKE '"&Request.Form("Sstring")&"'" , conn
But i've that's generate an error in my explorer...
I have a sql statement that pulls up a certain amount of records according to a requirement. Let's say that 20 records show up. I want to get to the 5th one. Well now I know that I can use the move() function to enable that, but it is the same page.
The page executes the sql statement and by default shows the last record in the query. Now when I ask for the 5th record the page is reloaded, the sql statement exectures AGAIN and the 5th record shows up. Is there way to ask for the 5th record without having to re-executing the SQL statement?
Given the following that results from a form which has multiple checkboxes with the same name value, the resulting string when stored into a variable is this - 129,200,323,330 I used the replace function and got this - 129 OR 200 OR 323 OR 330.
I want to somehow use these values (ints) to specify the particular records in an access database and populate a record set.
When I do this, I get nowhere - "Select * From images WHERE id=" & img_ids
Whereas img_ids is the above string...
I've got the following statment in my website:
<%
if session("memberId") = objrs.fields("memberId") then
%>Some Id<%
else
%>Different Id<%
end if
%>
The problem is, if boths are the some number it still displaing Different Id.
Is there anyone can tell me what am I doing wrong?
Now here is my insert statment and it is giving me this error message:
Insert Record
'strSQL2 = "INSERT INTO tblCONTENT_Links (LinkID, ContentOwner_UserGroupID, ContentGrouping, LinkHeaderOrder, LinkDescription, LinkName, LinkURL, LinkHeader, LinkHeaderCategory, LinkRefSite, Active, Archive, UpdatedDate, UpdatedBy, PasswordProtected, CommonLibrary) values ( 141, 7,'public', " & Category & " ,'" & DocumentName & "','" & DocumentTitle & "', '" & Document & "', 0 , 28 , 'www.skyclimber.com', -1 , 0 , #8/27/2004# , 0 , 0, -1)"
IE error:
Syntax error in INSERT INTO statement.
I'm using the following code on my website:
if left(session("lastPage"), 5) <> "admin" then
session("return") = session("lastPage")
else
session("return") = ""
end if
My problem is even the "left(session("lastPage"), 5) is equal to "admin" it still not equal the variable session("return") to "". Can anyone please tell me why or what Im doing wrong?
how i would go about using an if statment against a field in a database.
i.e
if id = "fieldname"
then
do this
else
do this
end if
I am still learning asp and would be very greatful if someone could help me.
What is wrong with this statment:
SQL = "SELECT tblEmployee.*, tblDepts.deptdesc, tblEmployee.Inactive FROM tblEmployee INNER JOIN tblDepts ON tblEmployee.DeptID = tblDepts.deptid WHERE " & request.form("txtSearchIn") & " LIKE '%%" & request.form("txtSearch") & "%%'" & " ORDER BY LastName, FirstName"
I am getting a error:
Syntax error (missing operator) in query expression 'LIKE '%%%%''.
I am hoping that some one can tell me how to add an ORDER BY statement to the following:
<% set rst = createobject("adodb.recordset")
set rst = conn.execute("select RegClassID, StartDateTime, EndDateTime, Description, Location, SpecialNotes from CAL_EVENTS_REG_CLASSES where RegistrationID = "&RegistrationID)
if not rst.eof then %>
The recordset returns fine, execpt I need to be able to order it ASC
im trying to write a sql statment that will insert a variable number of fields into a database the code below is what i want to do but i know this wont work anyone any ideas?
or even if this can be done?
sSQL = "INSERT INTO sometable("&For Each field In Request.Form ; "&Field&"," next ; &")values"('" "&For Each field In Request.Form ; "&Request.Form(Field) &"','" next ; &""')"
I'm using the following code in my website that is not working:
Dim objRS
strSQL = "UPDATE tblasp SET view = " & session("NumberOfViewer") & " WHERE id = " & session("aspId") & " "
Set objRS = Server.CreateObject("ADODB.Recordset")
objRS.Open strSQL, objConn,2,2
Is there someone please could tell me what am I doing wrong?
i was using INSERT INTO statment for insrting data to a mdb database file
eg
but now it is not working
there is an error
"Operation must use an updateable query. "
i want to display the number of people logged on at each location... when someone logges in they get a type=1... that works great but when i try to group by the NasName thats the location name.. Code:
View Replies View RelatedI need to know how to do this IsNull update statment in ASP:
"UPDATE tblUsers SET username='" & lcUName & "', hash= IIf(IsNull([lcHash]),"",[lcNewHash]), inactive=" & llAct & ", locked=" & llLock & ", isadmin=" & llAdmin & ", attempts=" & lnAttempt & ", lastlogin=" & ldLastLogin & ", onlyreadaccess=" & llOnlyRead & " WHERE UserID = " & lnSetID
ContentID is primary_key ID and it is automaticlly created upon this insert, but want to also insert that content id in table Category column ContentId. Code:
View Replies View RelatedI'm getting this useful error '80040e14' when trying to run a select statement in an ASP page. The connection to SQL Server 2000 is ok. The variables in the Select statement, 'area' or 'areaid' are passed through form the previous page ok.The code is below... Any ideas? Is it something obviously dense on my part?? Code:
View Replies View Relatedi have a select case statement that checks for a couple of options e.g.
<%select case aParameters(0)
case 0 %>
.. some code
<%case 2 %>
however i would like to test for a certain condition within the select cases statment. To see if a session variable exists before implementing some code:
I am Trying to use the SQL SELECT Statment to open records from multiple tables into one recordset.
I know the basic syntax of the Select statment but I wanted to know if its possible to recive the table name from the feild or the record that I am readinf from the recordset in any given moment.
To make things more clear, my example:
-Open a connection
SQL = "SELECT * FROM TABLE1,TABLE2 WHERE TABLE1.UserID=" & uid & " And TABLE2.UserID=" & uid
rs.open sql,conn,3,3
while not rs.EOF
-read from record
rs.movenext
wend
rs.close
conn.close
now, in the part that I read from the record, is their any way I can know if that record is from table1 or table2?
I keep getting an error when I try to run this update statment: [CODE]
INSERT INTO MYPosts ( IEname, country, server_name, LANIPAddy, license_ver, wrkstn1, wrkstn2, wrkstn3, wrkstn4, wrkstn5, notes, status, rdse, esc, eso, parent, , timezone, ) VALUES ( '" & lcIEname & "', '" & lcCountry & "', '" & lcServerName & "', '" & lcLicenseVer & "', '" & lcwrkstn1 & "', '" & lcwrkstn2 & "', '" & lcwrkstn3 & "', '" & lcwrkstn4 & "', '" & lcwrkstn5 & "', '" & lcNotes & "', " & lcStatus & ", " & lnRDSE & ", " & lcESC & ", " & lcESO & ", " & lcParent & ", " & lcTimeZone & ")"
I get the following error:
Microsoft JET Database Engine error '80040e14'
Syntax error (missing operator) in query expression
However, when i opened a page on my pc the database string was:
DBFolder = path & "..mysqldataformuladata
I cant find the folder in question. Even when ftping.
Any ideas where is could be lurking?
I am trying to locate a file using the following code
Set objXMLHTTP = Server.CreateObject("MSXML2.ServerXMLHTTP")
strURL = "http://server/ApprovedAutoCAD/140-00007-01.dwg"
objXMLHTTP.Open "GET", strURL, False, "login", "password"
objXMLHTTP.Send
strReturn = objXMLHTTP.status
I get a 404 status back indicating that the file is not found, which is incorrect. I am able to locate XLS and DOC files on the same directory. Any ideas why I cannot find a DWG (Drawing) file?