Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
StringBuilder AppendFormat function
Message
De
13/02/2008 12:29:41
 
 
À
13/02/2008 11:35:30
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Versions des environnements
Environment:
C# 2.0
OS:
Windows XP
Database:
MS SQL Server
Divers
Thread ID:
01292192
Message ID:
01292251
Vues:
23
>>Hi everybody,
>>
>>The following piece of code I would assume is supposed to put carriage return between each delete and insert, right?
>>
>>strSQL.AppendFormat("DELETE EventTargets WHERE EventID = {0}\n",
>>                e.Keys["EventID"]);
>>
>>            foreach (ListItem Item in lsbTargets.Items)
>>            {
>>                if (Item.Selected)
>>                {
>>                    strSQL.AppendFormat("INSERT INTO EventTargets VALUES({0},'{1}')\n",
>>                        e.Keys["EventID"], Item.Value);
>>                }
>>            }
>>
>>However, I see DELETE EventTargets where EventID=32INSERT... in the debugger. So, apparently my guess that \n is supposed to be CRLF is wrong.
>>
>>Or do you see what else may be wrong in this code?
>>
>>Thanks in advance.
>
>AppendFormat just adds to the end of a string. It allows you to "parameterize" content of the string. It has nothing to do with CR/LF.

But there's no reason why the string should not include a newline ?
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform