Cleaning Up Text For Database Insertion
I'm trying to write a page that will accept form POST method variables from another page and save them to an Access database via a DSN connection. I'm using code like this:
<%
SQL = "INSERT INTO myTable (postVar1,postVar2,postVar3)"
SQL = SQL & " VALUES ('" & request.form("postVar1") & "','" & request.form("postVar2") & "','" & request.form("postVar3") & "')"
dsnConn.execute(mySQL)
%>
I'd like to make sure that I clean up the text that the user inputs before trying to send it to the database. Can someone please give me an example of what ASP code I need use to get rid of quotes, slashes, and anything else a user could enter that might mess up the SQL insert?
View Replies
ADVERTISEMENT
I am using ASP Upload to upload an image to a website. I have other form fields in the form that are used to obtain data and are inserted into an access database. This occurs on the same page as the page that upload the image. Everything works fine except it inserts each record twice into the database. Anyone have an idea what causes this or what I can do to make it only insert once. I am useing the progress bar and don't know if that has anything to do with it. Here is my code.
Set rsPhoto = Server.CreateObject("ADODB.RecordSet")
Set Upload = Server.CreateObject("Persits.Upload.1")
Upload.ProgressID = Request.QueryString("PID")
Upload.SetMaxSize 500000, True
Upload.Save ....
View Replies
View Related
I need to know how to handle errors if a write to the database fails. Here's the pseudo-code:
View Replies
View Related
imagen a string with lots of zero's "0" in the string
how we can not only check and find the zero's but to delete it and to remain all the old structre of the string?
to get the old string without no zero's with no other changes
View Replies
View Related
What's the best way to clean your registry of multiple old component
references? I've got a few orphans in there from old versions, builds that
have been renamed, had source paths deleted, etc. I was going to use
RegClean but see a few warnings regarding to Office 2000 and later related
to it. I'm using Windows 2000, Office 2000, VB 6 and InterDev.
View Replies
View Related
I am trying to clean up Session.Contents so the user can go back to the main page and not retain any unnecessary info. I have entered this into my summary page, but it seems to only eliminate every other or every third entry. If I refresh the page about 0 times
everything eventually clears out. Anyone know why it would do this?
I don't want to use Session.Abandon because there are a few Session.Contents
I want to retain, like usernams and passwords. Code:
View Replies
View Related
I have a data entry form. If the user submits the form without entering any data, the record should be inserted with null entries for the respective fields.
But when i execute the INSERT SQL query with these null values, it gives me an error.
This is vat I am doing:
<%
.....
address = request.form("address")
if request.form("Age")= "" then
ageValue=""
.....
.....
%>
I use these values in SQL query
This is the SQL statement when the above is executed
" INSERT INTO tblStatistics (Age,address) VALUES (, aaa)"
Because of no value for age, the query is not gettin executed.
I dont want a 0, I want a nul entry (<null>).
Could someone throw some light on how to set the age field to null?
View Replies
View Related
My page is acting as if it is working but it is not depositing the values into the db. Should I be using a update query? My response.write statement is perfect as follows:
Code:
View Replies
View Related
I have a lil text box that I use to insert into a db. It inserts fine, but anytime i post something like
he said "i don't know" how to do this
the only thing that shows up is everything before the quote.
Am I suppose to be doing a replace for quotes also or does it only apply to apostrophes?
View Replies
View Related
A page I'm working on contains a registration form which is supposed to a) update an Access database using ASP and b) email the contents of the submitted form to the camp administrator.
This is my first experience with ASP, and with any kind of database interfacing language, for that matter. Currently I'm struggling with the record insertion. I'll worry about email afterwards.
I'm using Dreamweaver 8, which is generating all the code for me. I have a testing server set up on my local machine (in my working directory, in fact). I've told DW to connect to the databse (located in %siteroot%/database) through the testing server using a DSN (same DSN as on the web server). Code:
View Replies
View Related
anyone have a quick example of using insertion point of data with MSWC.Tools ?
e.g. how can I send data to "div" tag ?
Set oTools = Server.CreateObject("MSWC.Tools" )
oTools.processForm "output.asp", "template.asp", "<div>"
View Replies
View Related
I have a Dynamic product page that displays the items using "DO UNTIL rs.EOF" and I have assigned form input type to be hidden(for some) for information that I would like to retrieve. On the product page I have a "Add to Cart" button which points to my "addCart.asp".
addCart.asp is where I would insert the items into a Table called "cartItems" in the Database when the user clicks on the "Add to Cart" button.
My "addCart.asp" now generates a "Syntax error in INSERT INTO statement." which I think is caused by my inability to filter for the values from the product page and insert it into the "cartItems" table. Code:
View Replies
View Related
i have written a stored procedure. depending upon different parameters, query is prepared as string and executed through exec() function. it returns a certain number of rows. stored procedure also contains a temporary table. the question is this how can i insert the rows returned by the query in to temporary table?
View Replies
View Related
anyone have an example of using insertion point of data with MSWC.Tools ?
e.g. how can I send data to a "div" tag ?
Set oTools = Server.CreateObject("MSWC.Tools" )
oTools.processForm "output.asp", "template.asp", "<div>"
View Replies
View Related
I want o create a small site and I dont see the need for a database. So I want to use a text file for this site but I don't know how!
I know I can use Mysql or Access, but I don't want to. I simply want to use a flat file as it is called.
My site is an ASP site, so can anyone guide me on how to use "flat files" for databases
View Replies
View Related
how can i format text so it can be read by a database? for example, for numbers i do cint(whatever). whats the equivalent for text?
View Replies
View Related
I have 2 textboxes. In first text box i need to enter name, the second text box shud be automatically filled with the person'd id.
Both the name and id is coming from database. I tried using this code, but i'm getting error saying System.NullReferenceException: Object reference not set to an instance of an object. at line 1 Code:
View Replies
View Related
i am building a search form by word from text field in a table. for example the table has
1. ID
2. Price
3. Note
the Note field of a record could have sentence that contains words or jargon. What sort of method or approach can i use to solve the problem? can we use sql statement? if yes what sort of?
View Replies
View Related
Is it possible to store html tags in a database field so that when data is retrieved from this field the formating is retained? For example I have an address field in my database, which I return using:
<p><%=(rsType.Fields.Item("DAT_Address").Value)%>
However they are times where I may want to have my city, state etc on seperate lines by using <br>, but right now if I store a <br> in my database it does not affect the formating of my displayed address.
View Replies
View Related
I have a text field i am pulling from a database that uses vbcrlf to create line breaks.
I used the following code to replace them:
response.write Replace(rs_classes.Fields.Item("DESCRIPTION").Value, VbCrLf, "<br />")
But ran into the problem that when the field is blank, I get an error that shows a problem w/ the "replace" function.
So I tried the follwoing: Code:
View Replies
View Related
Question about the performance of using an include file or reading from a text file compared to hitting the database.
I set up a client's web site so they can post a weekly message and also post a "of special interest" message on their home page. Originally these messages were stored in and retrieved from an Access 2000 database. I decided to try writing the messages to a text file then retrieving it through include file and also tried the text streaming object.
I used netmechanic.com to gauge the download times for all three methods on a 56K modem. According to the results, using the database was around 4 seconds quicker. Does this sound right? The site is on a shared hosting package using Win2000.
View Replies
View Related
I'm trying to put some text into the database using ADODB.Command object. Seems like a reasonable thing to do and I can do it. But in this instance my text is an HTML code which contains many quotes. But i have to save it as is into the database field.
I use:
INSERT INTO (f1, f2) VALUES (v1, v2) comand. But since my v2 contains some quotes in it, (many quotes), I get an error. (it works otherwise). Is there any way ?
View Replies
View Related
As i write this post i have a variety of options to format my post such as bold, changing font, font colour, font size, putting text into paragraphs etc.
I am able to then preview all of this by clicking on "Preview Post". When i click on "Submit New Thread", my post gets stored inside a database (fully intact with paragraphs.)
I would very much appreciate anyone that can point me to script (prefferably ASP and javascript) to be able to do all of this including storing all the text fully intact (paragraphs) inside an access 2000 database.
View Replies
View Related
how to display data that I have in an Access Database to be formatted in paragraph style when I have it written to my asp page - but does anyone know how I can format text to display as bolded or to show http:// as a hyperlink?
View Replies
View Related
I have a database that was originally in Excel. After modifying it, I have saved it with .txt and another one with .csv format. DB.txt (Text (Tabl delimited)(*.txt)
DB.csv (Text Comma Separated Value) (*.csv). What is the command/statement in oppening database record for these formats?
View Replies
View Related
I am trying to make a guestbook, wich should be accessable through a executable exe. I think, the easyest way to do this, is through your browser. I am looking how to add text to a database without entering text in a form, but only text in the address bar of your browser.
View Replies
View Related
I am looking for a script in which I can replace any word in one table
(which corresponds) to other table with a link....
To for example when the name Bill Clinton is in a large piece of text in
TABLE1 and Bill Clinton is a row in TABLE2 then I want Bill Clinton in the
text to display as a link leading to a page where there's more info on Bill
Clinton from TABLE2
I was thinking something allong the way of: Code:
View Replies
View Related
how do i allow the user to add in a value that has a ' in it (e.g int'l) in the form. apperantly if i do that there will be an error... how do i go about this?
View Replies
View Related
I have two columns in my microsoft access database.
1st column is company_logo (jpg image)
2nd column is company_name (text)
I want to build a form, a dropdown box which I would populate with the help of a sql statement from my database. The both columns from up there are associated.
When the user clicks on that dropdown box, I need that company_logo and company_name to be shown one beside another. It should list all the companies availible (taken from that sql statement or recordset).
Does anyone knows if this could be done?
Maybe I should stick just with the textual part?
View Replies
View Related
I'm using Access Database with ASP. There is one particular thing that I
have issue with.
My purpose is for user to update their own profile. Their existing profile
information will be display in Edit Form format. The problem is if the field
has space, the second word will not display, when I display in input text
format.
E.g if My first name "User_FirstName" in my table has entry, let say "David
Johnson" as FirstName, when I execute following code and do a input text, it
will display "David" only. Code:
View Replies
View Related
I need some ideas in this if you can please help me.The folllowing is the scenerio:
I have a form which is the normal html with some validations and scripting done in javascript and i have a text box by name ticket no when the user enters a ticket no which exists in my database I need to update all my other form textboxes and textboxes with the data in the database else I need to show a alert that this doent exist in the database.
usually the event handling is done in javascript but now i have to call server side connection I have no clue how to do this.
View Replies
View Related
The user can search the database when they put in a date, that works fine, but when i put in another text box to search the database for a certain date range Code:
View Replies
View Related
I am trying to create an application feature for an inventory database and I am
wondering about the most efficient way to process the updates. Here's the background information: Code:
View Replies
View Related