Advertisement

07.09.2008 at 05:57AM PDT, ID: 23549983
[x]
Attachment Details

c# SQL Insert a variable with a comma  inside

Asked by myebay in MS SQL Server, C# Programming Language

Tags: C# sql

Hello,

string sqlString = "INSERT into MessageTable values ('" + msg + "', " + currentUser + ", " + receiverID + ", 'true')";

When I have a comma in the msg variable (like "YOu can't do that"), then I have a message error.
How can I change this? THanksStart Free Trial
[+][-]07.09.2008 at 05:59AM PDT, ID: 21963037

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: MS SQL Server, C# Programming Language
Tags: C# sql
Sign Up Now!
Solution Provided By: angelIII
Participating Experts: 4
Solution Grade: A
 
 
[+][-]07.09.2008 at 06:00AM PDT, ID: 21963043

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.09.2008 at 06:00AM PDT, ID: 21963053

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]07.09.2008 at 06:04AM PDT, ID: 21963094

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628