Update Statement
I am using the below update statement to update a field in a database.Which work fine until a user decided to use some punctuation with characters such as ' or ".
<!--#include file="../includes/connection.asp"-->
<%
Str_ID = request.queryString("ID")
str_Update = Request.Form("News")
str_Referer = Request.ServerVariables("HTTP_REFERER")
strSQL = "UPDATE Site SET News ='"&str_Update&"' WHERE ID='"&Str_ID&"';"
Set rs = adoCon.execute(strSQL)
Response.Redirect(str_Referer)
%>
View Replies
ADVERTISEMENT
I am trying to run a update statement to update a Microsoft Access database. Can memo fields be updated with ASP. I keep getting an error when the statement gets to the memo field?
View Replies
View Related
I started here only it doesn't work with single quotes in the name. It does work if there are no single quotes.
strSQL = "select * from Members WHERE co_name = '" & request("coname") & "'"
I get this error Microsoft JET Database Engine (0x80040E14)
Syntax error (missing operator) in query expression 'co_name = 'aa'a aaa'aa''
So I tried this:
strSQL = "select * from Members WHERE co_name = '" & replace(request("coname"), "'", "''") & "'"
It kind of works but stops outputing at the first space it encounters. It works good if there are no single quotes in the name. I'm writing the output to an input box.
In fact here is the code for the input box:
Response.Write "<td><input name=coname tabindex=5 value= '" & objRs("co_name") & "'></td>"
View Replies
View Related
chk whether i write correct or no..Code:
SQL_query1 = "update Activity_Status set TotalTime = '" & Request.Form("time") & "', Score = '" & Request.Form("QuizScore") & "' where UserID ='" & Request.Form("username") & "', ActivityName = '" & Request.Form("QuizType") & "'"
View Replies
View Related
I have no problems with a single "Where" clause, but I'm not exactly sure about my syntax when it comes to another part to my "Where" clause. Here is my statement:
conn.execute= "UPDATE STUDENT_INFRACTION_ACTION Set ACTION_NO = '" & ActionNumber &"' WHERE INCIDENT_NO = " & Request.Form("txtIncidentNumber") "AND STUDENT_ID = " & Request.Form("txtStudenID")
I'm receiving the following error:
Expected end of statement
/Development/Discipline_Form_Admin_Action_Submitted.asp, line 61, column 144
I've highlighted position of the error in my statement, but I'm not sure if I need the second set of parenthesis in my statment or not.
View Replies
View Related
strSQL = ("UPDATE dealer_login SET LastTime = Format(Now, "mm/dd/yyyy hh:nn:ss") WHERE Login = "' & TRIM(Request.Form.Item("userId")) & "'")
Expected ')' -- It is looking for a ) before the "mm/dd/yyyy for some reason.explain what is missing?
View Replies
View Related
I'm having trouble with the 'rs.update' method of adding new records. one person said I could use an update statement to do it. what's the code for it?
View Replies
View Related
If i want to add data to a field in a table with the update statement, is there anyway for it not to erase the data that's already there?
So for example
page1.asp has
UPDATE Topic1 SET [Topic Title]=('t1') WHERE ID=2"
then page2.asp has
UPDATE Topic1 SET [Topic Title]=('t2') WHERE ID=2"
So when you draw from that field later it will have t1 and t2 in the same field.
View Replies
View Related
I tried the modifications you suggested and I couldn't get it to work. Doesn't the MID function return a lenght in the string starting at a certain point?
I guess what I need to know how to do is write to a text box where the returned values have single quotes in them? I tried replacing the singles with doubles and it didn't work? When I do a search and there is no single quotes it works good.
View Replies
View Related
I am trying to run a simple update statement through asp and for the life of me can't figure out why it isn't working. I was wondering if anyone could look at this and tell me what may be wrong: Code:
View Replies
View Related
Would anyone know how to write an UPDATE Statement in ACCESS that contains more than one variable? For instance, something like this: Code:
View Replies
View Related
I'm having trouble with an SQL UPDATE string updating Microsoft Access 2000 with jet engine using ASP classic. I can't see what could be going wrong, as far as I can tell it's fine. I have tried surrounding my field names with brackets [] to no avail.
The error I receive is: Code:
View Replies
View Related
i'm trying to update a row in my Access Database by the AD_ID... i get the following error:
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC Microsoft Access Driver] Syntax error in UPDATE statement.
/alterantique1.asp, line 35
Here is the code:
View Replies
View Related
SQL = "UPDATE * FROM IME_request SET instructName = '" &InstructName& "', email = '" &email& "', school = '"&school&"', courseNumber='"&courseNumber&"', dateMonth = '"&dateMonth&"', dateYear = '"&dateYear&"', dateDay = '"&dateDay&"', description = '"&description&"', instructDesign = '"&instructDesign&"', techranger = '"& techranger & "', IP= '"&IP&"', completed = '"&completed&"', feedback = '"&feedback&"' WHERE courseNumber='" &courseNumber&"' "
I have a form that I want to update my database. I am receiving an error that reads:
Syntax error in UPDATE statement.
View Replies
View Related
I'm trying to update my counter in DB (Access) using sql query but the following error appears
Microsoft JET Database Engine error '80040e14'
Syntax error in UPDATE statement.
/cms/modules/test.asp, line 14
How could i solve this problem, here is sql query that i'm trying to run
sql = "UPDATE articles SET counter=counter+1 where (((aid) ="&aid&"))" .
View Replies
View Related
What am I doing wrong with my Update statement in with
javascript? Code:
View Replies
View Related
I wish to update certain records in a access database where the placeID is a certain number and the coststypeID can be other numbers. I am using the following code:
View Replies
View Related
ASP error number 13 - Type mismatch with SELECT...FOR UPDATE statement. I got ASP error number 13 when I use the SELECT...FOR UPDATE statement as below. However, if I use SELECT statement without FOR UPDATE, it is fine and no error. I also tried Set objRs = objConn.Execute("SELECT * FROM EMP UPDATE OF EMPNO"), but it still couldn't help.
Here's the code fragment: ....
View Replies
View Related
Okay there is an unique EventRegID for every registration. When people first register they get pre-registered. Then an admin comes in and confirms or wait list them (based on whatever requirements). My question is how can I tie the EventRegID to a form with multipule ID's so they can batch confirm or wait list the PreReg list? Code:
View Replies
View Related
If a user enters in this to search a db
"Jon Doe" James Doh
return all of the exact matches Jon Doe (user uses quotes to clarify an exact search)
along with that: return all of the James and all of the Doh as well
qry to look like this as soon as I am able to divide up the string entered in by the user
select * from table where (NAME LIKE '%Jon Doe%') or
(NAME LIKE '%James%') or (NAME LIKE '%Doh%')
Thinking of using the instr to find the " but then what do I do to find the string inside of the two quotes, One quote would be easy. there is a couple of checks to preform:anyone run into this before or have any ideas/samples, etc
View Replies
View Related
I have created a query wizard page with ddl as your choice to find info. now each ddl has a default of a dash.
The thing is I want to do is have the sql statement to look through the database even when some of the ddl have a dash on them. or just ignore the ones with a dash and look for the ones that are selected. Is there any suggestions for this.
View Replies
View Related
Below is my code for a question system i have created. However, i need to insert an if statement that redirects the user to test.asp if the value of q_id is not in my database, but i dont know how to do it?
<%
q_id = request("q_id")
sql = "SELECT * FROM questions WHERE PARENT_ID = 1"
Set objRS2 = Server.CreateObject("ADODB.Recordset")
objRS2.Open sql, objConn
sql_sql = "SELECT * FROM questions WHERE PARENT_ID = " & q_id
Set objRS3 = Server.CreateObject("ADODB.Recordset")
objRS3.Open sql_sql, objConn
%>
View Replies
View Related
my AND statement is not working and I dont know why????
sql = "SELECT * FROM calls WHERE tech=" & userID "AND status = Open"
tech and status are the DB fields
userID is a variable
Open is just a word
View Replies
View Related
i make a form with an AccountId box on it , when u enter the accountid in the box , and submit it will send u to a page that show u all the data for this accountid(retreive data)
until here everything is ok , and when i enter for ex. accountid : 5 , all the aacountid fiel data will be show to me , but the problem when i enter am unvalid accountid , it will give the error page that
what iwant to do that i want when i enter an unvaildaccountid an error text show to me like
response.write("The Id that u entered is unvaild , Try Again")
and this is the code , if u can change on it Code:
View Replies
View Related
I am trying to use the following IF statement, and whenever I use a
single or double quote, I receive a syntax error. When using no
quotes, the syntax is accepted, but the statement does not perform
properly.
***The problem line***
<% if violation_type=''Tardy'' THEN %>
***rest of the statement***
TARDY VIOLATIONS
<% if rs2.Fields(0) = 0 THEN %>
This is the first unexcused Tardy violation for this employee. A
coaching is required. Click <A HREF=blah>HERE</Ato issue the
coaching.
<% ELSE %>
This employee has <%response.write(rs2.Fields(0))%previous
violations.
<% END IF %>
<% ELSE %>
The <%response.write(violation_type)%violation has been recorded.
<% END IF %>
Variables defined:
violation_type = request.form("violation_type")
View Replies
View Related
On a page with a form (post method) and a hidden field "Process value = true", why would this statement not work:
<%
if request.Form("Process") = "true" THEN
The code in here sends an email to the user via CDOSYS
End IF
%>
This is what I have going on and it does not send the emal when the form is posted. Removing the If statement obviously sends the email the moment the form page is accessed, but thats not right.
View Replies
View Related
i have a couple of if statements and it goes something like this, the user will try entering their username and password in the login page then they will be taken to a verify page, then it will decided if the user can be send to the login page again or to the invalid page. The problem is that after 3 times the user is still send to the login page and not the invalid page My verify page code is :-
<%
session("try") = try
if try = "" then
try = 0
else
try = try + 1
end if
if try <> 3 then
response.redirect("login.asp")
else
response.redirect("invalid.asp")
end if
View Replies
View Related
Recordset1.Source = "SELECT `bestsellerslists`.`itemnumber`, `bestsellerslists`.`list`, `products`.`Product_ID`, `products`.`Product_Name`, `products`.`Price`, `products`.`Sale_Price`, `products`.`Smallpic` FROM `bestsellerslists` INNER JOIN `products` ON (`bestsellerslists`.`itemnumber` = `products`.`Product_ID`) WHERE (`bestsellerslists`.`list` = "girlinfant")"
In Macromedia, the recordset tests fine. When I start the page, I get an error. Do you see anything wrong with this? If I delete the WHERE clause it works.
View Replies
View Related
I'm having a problem with my variables. They print to screen fine, but when I try comparing them, they don't work. Can anyone tell me what I'm doing wrong?
If Category <> CurrentCategory then
response.write "<tr><td>Category:" & Category & "</td></tr>"
response.write "<tr><td>CurCategory:" & CurrentCategory & "</td></tr>"
else
response.write "<tr><td>hello</td></tr>"
End If
Code:
View Replies
View Related
I am passing in values either customer id (key) or their names (name) from a form .
You don't have to use both the id and the name to search for the customer however I don't know how to do this!
If the keyform = "" then , use the name to find the customer
else
can't find it! this is what I have at the moment :
keyForm = Trim(request("key"))
name Form = Trim(request("name "))
Dim name , cyfeiriad, tref, sir, codpost, ebost, ffon, cyfrif, dyddiad
Set dnsSQL = g_con.Execute("SELECT key_user_accounts,name ,cyfeiriad,tref,sir,codpost,ebost,ffon,cyfrif,dydd iadcreucyfrif from cwsmeriaid Where key_user_accounts = " & keyForm & "
if not name = "" then and name = '" & nameForm & "'")
else ")
end if
View Replies
View Related
ii am using a statement to send a query to the SQL server and i am getting errors like expected end of statement.
what might be the problem and do i use a statement like this for dynamically assign values or it's better to use stored procedures.
dim mySQL="Select * from logindetails where loginname='" & logname & "'"
View Replies
View Related
what am i doing wrong:
SELECT * FROM Tablename WHERE Content LIKE '%Netcapa%';
this is the error im getting
ADODB.Recordset error '800a0bb9'
View Replies
View Related
I was wondering how do you arite an SQL statement that only displays the list of projects from the last 30 days (i do have a date field as well)
View Replies
View Related