Solved

how can I insert this string into sql??

Posted on 2006-06-19
7
348 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
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

 
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

Industry Leaders: 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

In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Progress

707 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