المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Double quotes in c#



C# Programming
06-12-2009, 02:23 PM
Hi I have the folowing code for creating an sql query
string cmdText = "";
if (machines.Count > 0)
{
cmdText = @" AND CHECKINOUT.SENSORID IN ( ";
int counter = 0;
foreach (int itemId in machines)
{
cmdText += "\"" + itemId.ToString() + "\"";

if (counter != machines.Count)
{
cmdText += ",";
}
counter ++;
}

cmdText += ")";

}
The \" is not working. I want to have a sort of display like ("1","2") but I am having (\"1",\"2"). Can someone help me please?