|
-
Jul 14th, 2001, 11:20 AM
#1
Thread Starter
Hyperactive Member
writing textarea to database
My ASP page (using VBScript), doens't seem to like my request of writing the contents from a textarea to a field in my database. The field is set to data type Memo. I get the following error when the page loads:
Code:
Microsoft OLE DB Provider for ODBC Drivers error '80004005'
[Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement.
/forums/postnew.asp, line 37
Where, line 37 tells the page to update the recordset (Message_Data.Update)
Here is the page I am talking about:
http://www.pcgamesforyou.com/forums/postnew.asp
Thank you.
Alexander
Last edited by spandex44; Jul 14th, 2001 at 11:27 AM.
-
Jul 14th, 2001, 12:32 PM
#2
Lively Member
It would be easier if you gave us some code we could look at...
-
Jul 14th, 2001, 12:55 PM
#3
Thread Starter
Hyperactive Member
Here's the entire code for that page:
Code:
<html>
<head>
<title>Post New</title>
</head>
<body>
<form method="POST" action="postnew.asp">
<b>Username: </b>
<input type="text" width="50" name="txtUsername">
<br>
<b>Title: </b>
<input type="text" width="50" name="txtTitle">
<br>
<b>Message: </b>
<br>
<textarea name="txtText" rows="6" cols="50"></textarea>
<br>
<input type="submit" value="Sign Up">
</form>
<%
Const adOpenStatic = 3
Const adLockOptimistic = 3
Dim Connect, User_Data, Query
Set Connect = Server.CreateObject("ADODB.Connection")
Connect.Open "forum_database"
Set User_Data = Server.CreateObject("ADODB.Recordset")
Query = "SELECT * FROM messages"
User_Data.Open Query, Connect, adOpenDynamic, adLockOptimistic
User_Data.AddNew
User_Data("Poster") = Request("txtUsername")
User_Data("Title") = Request("txtTitle")
User_Data("Text") = Request("txtText")
User_Data.Update
%>
</body>
</html>
Here, forum_database is my DSN, connect is my ADODB connection, and messages is a table in my database with the fields: Username, Title, and Text
-
Jul 14th, 2001, 01:05 PM
#4
Lively Member
Try this instead...
Code:
Set Connect = Server.CreateObject("ADODB.Connection")
Connect.Open "forum_database"
Connect.Execute("INSERT INTO messages (Poster,Title,Text) VALUES ('" & Request("txtUsername") & "','" & Request("txtTitle") & "','" & Request("txtText") & "')")
-
Jul 14th, 2001, 01:11 PM
#5
Thread Starter
Hyperactive Member
Nah, that didn't wnat to work either, unfortunately. That is just a different way of posting that information to the database, I think that the problem lies with the data type of the database's field, or the type of input object (textarea), because I am able to write normal textboxes to a database.
-
Jul 14th, 2001, 01:22 PM
#6
Lively Member
When I save textarea-values into a database I use PM as type in the dbase. I think this is the Swedish version, and I'm pretty sure that PM is the same thing as Memo...
try
Code:
response.write(request("txtText"))
and see if it has a value.. textareas are a bit weird sometimes... and try use Request.Form instead of just Request
-
Jul 14th, 2001, 02:28 PM
#7
Thread Starter
Hyperactive Member
I tried that, and it did have a value. So that isn't the issue either... The Request.Form idea also didn't want to work. This is very irritating. I apprecaite your help, and hope we can solve this!
-
Jul 14th, 2001, 08:02 PM
#8
Thread Starter
Hyperactive Member
It turned out that the fieldname was Text, which is also an Access keyword, so that's what caused the error. As soon as I changed the fieldname, it worked. Thanks for your help.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|