By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,551 Members | 2,622 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,551 IT Pros & Developers. It's quick & easy.

ASP/ADODB - Memo fields and richtext format

P: 3
Hi! i'm new here.
this place looks nice so i would like to try my luck here!

I've a question :
How can I insert multiline richtext into MSACCESS database?
at first I thought I could store it into a memo field, but it seems that i'm doing something wrong since it's crashing with the exception : INSERT INTO sql syntax is invalid.

(The DB, tables and fields name were double-checked)

Here's the dreaded code :
Expand|Select|Wrap|Line Numbers
  1. Set con = Server.CreateObject("ADODB.Connection")
  2.  
  3.         con.Open logins
  4.  
  5.         msg_id = 1 'for testing purpose only
  6.  
  7.         SQL_query = "INSERT INTO msg_inbox VALUES(" & msg_id & ", '" & request("destinataire") & "', '" & Session("username") & "', '" & date() & "', '" & request("message") & "'"
  8.  
  9.         Set RS = Server.CreateObject("ADODB.Recordset")
  10.  
  11.         RS.Open SQL_query, con, 0, 3
  12.  
-=-=-=-=-
In the SQL query :
values -> msg_id, as the message id (Daahh) numeric value
request("destinataire") as a string
Session("username") as string
Date() as string (didn't want to bother with formatting)
request("message") as MEMO in ACCESS and as textarea in HTML

thanks for your help guys!
rs.Close()
con.Close()
Oct 14 '07 #1
Share this Question
Share on Google+
5 Replies


MMcCarthy
Expert Mod 10K+
P: 14,534
You forgot the closing bracket on your insert statement.

Expand|Select|Wrap|Line Numbers
  1.         SQL_query = "INSERT INTO msg_inbox VALUES (" & msg_id & ", '" & request("destinataire") & "', '" & Session("username") & "', '" & date() & "', '" & request("message") & "')" 
  2.  
Oct 14 '07 #2

P: 3
god... How can I be so dumb lol
i'll try and retrieve the data FROM the DB now and see what happens
Oct 14 '07 #3

MMcCarthy
Expert Mod 10K+
P: 14,534
god... How can I be so dumb lol
i'll try and retrieve the data FROM the DB now and see what happens
LOL!

We've all been caught. Its very easy to notice it in someone elses code but difficult to see in your own.
Oct 14 '07 #4

P: 3
read works llike a charm.
My new internal PM system is up and running, thanks alot
Oct 15 '07 #5

MMcCarthy
Expert Mod 10K+
P: 14,534
read works llike a charm.
My new internal PM system is up and running, thanks alot
You're welcome!
Oct 15 '07 #6

Post your reply

Sign in to post your reply or Sign up for a free account.