View Full Version : Error - inserting into a database.
Mhtml
10-27-2002, 01:19 PM
I'm trying to insert a long string from a textarea form field into a database and it is coming up with a sytax error after a certain amount of characters.
The field in the database is a memo field.
It is fine with 2 or 3 sentences but anything like what I've written here is just to much for it and it goes bonkers.
Any thoughts?
webmarkart
10-27-2002, 01:48 PM
I don't know if this could actually work but I think it works in theory. I'm not sute what the max length of a field in a memo is, but what if you split the data you are trying to enter at the max number of characters. For example if you have a text field with 2000 characters and the max is 1000, split the data into two strings of 1000 each and insert them into diferent fields.
Like I said, I'm not sure if it could work, but it will give you something to try at least.
BigDaddy
10-27-2002, 02:14 PM
If we knew more about the specific errror, it woudl be easier to troubleshoot.
Can you tell us exactly what it says? It might be a limitation of space, but if it happens after only a few sentences, I think Access or most other databases could handle it.
scroots
10-27-2002, 02:54 PM
it is to do with the database field cannot handle the size of info being added, so you will have to split it.
scroots
whammy
10-27-2002, 04:27 PM
What's the error? If it's a "syntax error", it has nothing to do with the field size... did you replace single quotes with another one to comment them?
Can we see the code?
:)
Mhtml
10-28-2002, 06:27 AM
It is still a work in progress as I forgot to make the "year" form field do anything as well as forgot about this error...
Anywho I've uploaded the .zip file which contains the files including the database.
The scripting actually occurs in the newsflashinc.asp file, the login for the admin so you can add a news article is..
User: Admin
Pass: God
Please feel free to make any tweaks or fixes you feel are necessary but don't go out of your way..:)
Mhtml
10-28-2002, 06:42 AM
Also I didn't think about it until just now but you must change the database path in the script to db/newslfash.mdb instead of whatever is there now, the reason for this is that database is the blank one which gets distributed with the script and I was using my own site database with the appropriate table because I can.;)
Mhtml
10-29-2002, 06:26 AM
I recently noticed that scriptblur posted a question on replacing the ' marks and was wondering if that may be the problem? Since you will more than likely be testing the script you will be able to see if it is...
whammy
10-29-2002, 11:41 PM
That was indeed the problem. Attached is the same solution I posted (already implemented). :)
Mhtml
10-30-2002, 12:47 AM
Thanks Whammy!:D
whammy
10-30-2002, 12:56 AM
No problem, my young friend. :)
You oughta check out the recent posts and dominicall's "functions.asp" here (http://www.codingforums.com/showthread.php?s=&threadid=8806)
and I will give you my very similar "regex.asp" if you want it too. This kind of data validation will save you lots of time. I just need to get a copy of the updated one I'm using on my local machine first, and you can be my guest. With both of them combined, you could probably validate almost anything (or by studying them write your own functions that will validate anything)... just like using the built-in functions of VBScript!
:D
Mhtml
10-30-2002, 07:19 AM
Sweet!:)
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.