Inserting Apostrophes Into DB?
When I insert info into a DB from a form, it cuts the string off at the first apostrophe (").
How would I make it insert the data as-is, with the apostrophes? Here is the code used to insert the Data:
When I insert info into a DB from a form, it cuts the string off at the first apostrophe (").
How would I make it insert the data as-is, with the apostrophes? Here is the code used to insert the Data:
I did a search about inserting names that have apostrophe, and found something about escape apostrophe? how to do that? When the user tries to insert a name with an apostrophe it blows up. Also the delete page I have doesn't like names with apostrophes in the where clause.
View Replies View RelatedI put in some code to keep apostrophes from being a problem. However, on the
display page, they have double quotes. What am I doing wrong?
Here is the code on the page which captures the data from the form, right
before it gets entered into the database:
------------------------------------------
strInternalDesc =
Replace(Replace(Trim(Request.Form("InternalDesc")),"'","''"),vbCrLf,"<br>")
------------------------------------------
then, on the page where it gets displayed, I get:
I have an apostrophe in an access database in a name. e.g. O'Brien. When I read this value back into some script the apostrophe seems to be terminating my script.Unless of course I have mis-understood what's going on
Are there any rulesguidelines for this sort of data handling
Been a while since I've done any asp coding, but happy to be getting back
into it. My question is what is the best way (now) to handle apostrophes
coming in from forms and going into the database? I remember I used to use
a replace function replacing single quotes with two single quotes in one of
my old apps.
Is this still the best way, use this function on all fields I
think an apostrophe may come in, or on all fields? Or should I use a
javascript regular function (which may not even work due to a client
disabling this feature on their browser)?
I need to insert field data with apostrophes into Access. However, I keep getting "object expected" errors when I post. I heard about using the replace function like this:
var incidentlocation = Replace(Request.Form("incidentlocation"), "'", "''");
but I get the "object expected" error. What I am doing wrong? My code is below in the text file.
I have a page where students can choose activities in a day... this then directs them to their timetable for that day.
However, if they go back to the choose.asp page and they have already registered, I redirect them to timetable.asp - because I don't want them to change their options.
I have their username stored as a session variable and it works fine for most students - however for the example student O'SMITH-JONESMark the page falls over.
I am using Dreamweaver's 'redirect if username exists' server behaviour. Code below... Can anyone tell me how to fix this so the code is not tripping up over the odd characters? Code:
There i seem to be having a problem when inserting certain characters into my access database using a form, mainly (') characters.
View Replies View RelatedI get the following error message
Microsoft VBScript compilation error '800a03ee'
Expected ')'
/weblinkup/chat.asp, line 1775
oConn.Execute("INSERT into chat (username,nametext,roomname,type,priv,thetime,msg) VALUES ('" & username & "', '" & username & "', '" & Roomname & "', 'msg', '0', '" & now() & "', '" & username & " has just said " & emotetarget & "." ')")
what the problem is with the code?
i have a database Access with Book Table and Author Table. now i have created a form which inserts info submitted into the Book Table, yet it keeps giving me this error "You cannot add or change a record because a related record is required in table 'Author' " while the names of the authors are all registered.
it works in Access but not in asp it doesn't make much sense. People just enter the names of the books which their authors are in the Author table. it keeps giving me error. how to know why this is so?
I have an error as follows:
Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC SQL Server Driver][SQL Server]Could not bulk insert. File 'c:mydata.csv' does not exist.
My mydata.csv file is inside the directory i stated. But why does the server complains that the file is not fould?
My codings:
strSQL = "BULK INSERT NAME FROM 'c:mydata.csv' WITH (FIELDTERMINATOR = ',',ROWTERMINATOR =
'
')"
Response.Write ("test")
Set oRS = conn.Execute(strSQL)
I had some Error when i write the update sqlp query
Error Type:
Microsoft VBScript compilation (0x800A0401)
Expected end of statement
/fyp/Quiz/updateQuiz.asp, line 21, column 77
SQL_query= "update Activity_Status set UserID = '" +Request.Form("username") "'" "where Score = '" +Request.Form("QuizScore" + "'")"
Code:
SQL_query= "update Activity_Status set UserID = '" +Request.Form("username") "'" "where Score = '" +Request.Form("QuizScore" + "'")"
I'm using ASP + MS SQL. I wrote a simple insert into command but nothing is happening... it gave no error and no information is stored in the db. When I response.write my SQL, I got the following:
INSERT INTO [blog_entries](title,user,entry,date) VALUES('test','admin','test','Tuesday, December 25, 2007')
I'm wondering if it's possible to create an instance of an ADO Recordset and add values to it by ASP ??
Ex :
I have 2 arrays :
arr1 = Array(1,"allo")
arr2 = Array(2,"bonjour")
Is it possible to add these 2 arrays into a Recordset to manipulate de data more easily?
If yes, could you provide me with a little example to see the synthax, because I tried almost everything and it didn't worked at all
how do i design my site interface such that users can insert smilies along with text in the form field just like it is here on sitepoint...
View Replies View Relatedi've tested my code and it seems to send back an error, when i'm trying to insert a record into my db (sql server)
Basically when I udpate one of the records it's fine ( I update at a certain "productID")
But when I insert a new record it sends back an error telling me that my "productID" can't be a null value?Any ideas on how to fix this?
I am developing web pages , therein doing database
connectivity using ASP with Microsoft Access.I want to
insert a file (.opt/.pmopt) into a field 'OLE Object'. Also
I want to display that file name in tabular form and a link
to download that file.
I am trying to make a web-based front-end for one of our programs. I'm running into a problem. Here's a sample of one of our tables:
Code:
CaseNo ChargeCount ArrestCharge FiledCharge
123 1 13 13
123 2 14 14
199 1 03 03
The ChageCount column cannot have nulls and must be unique. is there a way when I'm adding a new charge, i can check to see if a chargecount exists? For example, if inserting a new record, it will first check if there is a chargecount, if there is not, it will make it 1. if there is a charge count, it will +1 to the existing chargecount
Im doing a update page and noticed this error, whenever you want to write for example "can't, i've" it errors on submit, but characters like "." are okay. Why doesn't it like these characters and how can i make it like them? I need some extra code?
View Replies View RelatedI have the folllowing page where a user can add a review to the website. So far the page works fine, but on the review rating section I know that the rating is between 0 - 5.
But its posible for a user to enter 1000 if they wished, which still means the page works but the answer is too high.
Also if they write text in the field it errors the page. How do i code this so that they can only enter a number between 0 and 5 and only a number and not text.
I want to make a button just like here (when posting new thread) to insert hyperlink into text.
For example when user is typing text into textarea I would like to have also a button that can enable users to post different links to other intenet pages.
And I would also like to have button that makes the text bold
(Actually those are buttons that appear on most forums when posting a new thread)
I got a webpage in which I am cheking various checkbox values.Actually the problem that I am facing is that,I am not able to insert the contents in to the database.
But no error is coming.What I am doing is that,when the user submits the form,using a retrun querystring,i am storing all the checked values in to an array.I am able to print this array with correct output.But whn i am trying to insert in to the database,it is not getting inserted.
I'm having problems inserting into a table in an oracle database. I am reading in variables from a ASP form and trying to enter these into the database. however only numbers will insert, even though I can print out the string variables on the ASP page. IF I inclose a string value in the insert statement it works ok so there is nothing wrong with my SQL code. Code:
View Replies View RelatedI am right now calculating distance between 2 zip codes and storing them in a table along with extra information like a persons name and address and stuff like that.
For some reason for distance "0" ..doesnt get inserted in my table..? What do i need to do in my code so that "0" distance + information gets in the table since i need that info to be displayed later for people to make calls to those people with 0 distances.
I have created an online database for a school project, and everything WAS going fine until today. I created the add record page and for some reason, whenever i try to add the records to the database THIS error message comes up: Code:
View Replies View RelatedI have successfully pulled data from an LDAP server and now what I want
to do is drop the data into a database table. The following is my code
that will insert the data but that has problems.
I have a form that I submit to an oracle database. Along with the info from the form I want to insert the date it was submitted. How should I go about doing this? I am having problems because it is the wrong format?
I am using a 'date' data type for the field. How can I convert the date into the correct format that will allow me to submit it, I have tried using to_char or to_date, but they give me an error?I tried using this to convert it, but it doesn't work, I am getting a syntax error?submit_date=to_date(date,'YYYY-MM-DD')
I am trying to insert a record into an access database, to just one table, using an insert form created from dreamweaver.However when i open the page, enter the details and click submit, it re-directs me back to the same page, rather than the confirm one.
The weird thing is, i created an identical page for to insert a record into another table in same database and it works fine. There is also a problem when trying to update/delete a record from the same table.
How do I insert a space after every 4th character in a string?I'm presuming I somehow use the replace function?
View Replies View RelatedHow to do subj ?I tried:
date1=NULL
strSQL = "INSERT t (mydate) VALUES("&date1&")"
i tried with ' ' and without, tried "''", i tried allmost all variations &because i cant put NULL, i have error in my main strSQL.
i m reading data from a excel file and inserting its fields into access database, everything is fine but i m getting problem when i m insertin the data string into the date/time field of the aceess database,i have use the CDate function but it is not working.what should i do?
View Replies View Relatedis there a way to run an ASP script from an html page?the script is obviously written on an ASP page elsewhere but I want it run from HTML or SHTML.so they dont figure out the URL of my ASP page.
View Replies View RelatedI have encountered a problem when a user submits text which contains commas and quotation marks.
Code:
Function ChkString(string)
If string = "" Then string = " "
ChkString = Replace(string, "'", "''")
End Function
I am currently using the above code, but what i have realised is that i am losing whole text that does not get entered into the database, when i wrap commas and quotes around it.