Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hi

When I try to save the html source of my html page inside a microsoft dhtml edit control into an Access .mdb database, I get this error:

OleDb.OleDbCommand("INSERT INTO MyOwn (HTMLSource) VALUES ('" + DHTMLEditControl.DocumentHTML + "')", MyConnection)

Syntax error in string in query expression ...

 

It should be because of HTML tags, so what should I do?

Any help? Thanks.

  • Administrators
Posted

If the HTML contains any special SQL characters (like ' for example) then you will end up with a statement that SQL cannot parse. You will either have to encode all such characters on the way in, decode them on the way etc.

 

Or as an alternative simply use parameterised SQL - this way you don't have to worry about special characters etc.

Posting Guidelines FAQ Post Formatting

 

Intellectuals solve problems; geniuses prevent them.

-- Albert Einstein

Posted

Yes html source contains both ' and " characters.

You gave me 2 solutions but I was not able to understand any of them!

How is encoding?

Or how to use parameterised SQL?

Thanks:)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...