[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

how can I insert this string into sql??

Posted on 2006-06-19
7
Medium Priority
?
352 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
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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
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

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!

Question has a verified solution.

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

If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
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…
Loops Section Overview

873 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