[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

how can I insert this string into sql??

Posted on 2006-06-19
7
Medium Priority
?
351 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 2000 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

A short article about problems I had with the new location API and permissions in Marshmallow
This article will show how Aten was able to supply easy management and control for Artear's video walls and wide range display configurations of their newsroom.
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…
Simple Linear Regression

649 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