Solved

how can I insert this string into sql??

Posted on 2006-06-19
7
347 Views
Last Modified: 2010-04-17
I have problem with quote and double quote :(

qr = "UPDATE Task SET Finished = '<td class='biz'></td><td class='isp'><img /><img src='styles/spunta.gif'></td>' WHERE" +
            "Username+task+CONVERT(VARCHAR(10), tasktime, 103) = '" + e.CommandArgument.ToString() + "'";
        cm = new OleDbCommand(qr, con);
        con.Open();
        cm.ExecuteNonQuery();
        con.Close();
0
Comment
Question by:tatamaruri
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 500 total points
ID: 16939722
qr = "UPDATE Task SET Finished = '<td class=''biz''></td><td class=''isp''><img /><img src=''styles/spunta.gif''></td>' WHERE" +
            " Username+task+CONVERT(VARCHAR(10), tasktime, 103) = '" + e.CommandArgument.ToString() + "'";
0
 
LVL 7

Expert Comment

by:dttri
ID: 16939808
To clarify angelIII answer: replace ' (single quote) with '' (double single quote, not a double quote)
0
 

Author Comment

by:tatamaruri
ID: 16939828
can't do like this: qr = "UPDATE Task SET Finished = '<td class=''biz''></td><td class=''isp''><img /><img src=''styles/spunta.gif''></td>' WHERE"

in ASP.NET if you use " ,it mean you finish a string. So that you will get error at "biz"
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 26

Expert Comment

by:DireOrbAnt
ID: 16939871
qr = "UPDATE Task SET Finished = '<td class=""biz""></td><td class=""isp""><img /><img src=""styles/spunta.gif""></td>' WHERE" +
            "Username+task+CONVERT(VARCHAR(10), tasktime, 103) = '" + e.CommandArgument.ToString() + "'";

to escape double quotes, use ""
0
 

Author Comment

by:tatamaruri
ID: 16939885
To: DireOrbAnt

I did as you said but get error: "; expected" at string ""biz""></td><td class=""isp""><img /><img src=""styles/spunta.gif""></td>' WHERE"

:(
0
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 16939896
>in ASP.NET if you use " ,it mean you finish a string. So that you will get error at "biz"

please check carefully, i posted ''biz'' which is not the same as "biz": 2 single quotes vs double quotes.
0
 

Author Comment

by:tatamaruri
ID: 16939938
Yeah, Thanks.
I did it
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question