Click here to Skip to main content
15,890,043 members
Home / Discussions / Managed C++/CLI
   

Managed C++/CLI

 
AnswerRe: project help Pin
toxcct4-Apr-06 22:02
toxcct4-Apr-06 22:02 
AnswerRe: project help Pin
Cedric Moonen4-Apr-06 23:02
Cedric Moonen4-Apr-06 23:02 
GeneralRe: project help Pin
reyou5-Apr-06 4:43
reyou5-Apr-06 4:43 
QuestionI got some parameter problems Pin
GDavy4-Apr-06 2:26
GDavy4-Apr-06 2:26 
AnswerRe: I got some parameter problems Pin
toxcct4-Apr-06 2:31
toxcct4-Apr-06 2:31 
GeneralRe: I got some parameter problems Pin
GDavy4-Apr-06 3:22
GDavy4-Apr-06 3:22 
Questionis there any function similar to sprintf in C++.Net? Pin
Kranti12519844-Apr-06 1:08
Kranti12519844-Apr-06 1:08 
AnswerRe: is there any function similar to sprintf in C++.Net? Pin
2bee 4-Apr-06 1:22
2bee 4-Apr-06 1:22 
Kranti1251984 wrote:
I've to write a query which requires a function similar to "sprintf" in C

For e.g.

String *query; // in c++.net
sprintf(query, "Select * from table_name where number = %d", no); // in C

How can this be done in this environment?


Hi Kranti1251984,

yes, there is actually. For instance you could use:

System::String::Format(...)

<br />
	String^ s = String::Format(<br />
        "(C) Currency: . . . . . . . . {0:C}\n" +<br />
        "(D) Decimal:. . . . . . . . . {0:D}\n" +<br />
        "(E) Scientific: . . . . . . . {1:E}\n" +<br />
        "(F) Fixed point:. . . . . . . {1:F}\n" +<br />
        "(G) General:. . . . . . . . . {0:G}\n" +<br />
        "    (default):. . . . . . . . {0} (default = 'G')\n" +<br />
        "(N) Number: . . . . . . . . . {0:N}\n" +<br />
        "(P) Percent:. . . . . . . . . {1:P}\n" +<br />
        "(R) Round-trip: . . . . . . . {1:R}\n" +<br />
        "(X) Hexadecimal:. . . . . . . {0:X}\n",<br />
        -123, -123.45f); <br />
        Console::WriteLine(s);<br />


In addition i would like to point out, that it would be more secure to use parameters when constructing dynamic SQL statements.

best regards Tobias
GeneralRe: is there any function similar to sprintf in C++.Net? Pin
George L. Jackson4-Apr-06 12:35
George L. Jackson4-Apr-06 12:35 
QuestionIncluding .dll in /clr:pure project [VC++ '05] Pin
jantimmerman2-Apr-06 21:40
jantimmerman2-Apr-06 21:40 
AnswerRe: Including .dll in /clr:pure project [VC++ '05] Pin
Milton Karimbekallil3-Apr-06 1:35
Milton Karimbekallil3-Apr-06 1:35 
GeneralRe: Including .dll in /clr:pure project [VC++ '05] Pin
jantimmerman3-Apr-06 3:04
jantimmerman3-Apr-06 3:04 
GeneralRe: Including .dll in /clr:pure project [VC++ '05] Pin
Milton Karimbekallil3-Apr-06 13:53
Milton Karimbekallil3-Apr-06 13:53 
GeneralRe: Including .dll in /clr:pure project [VC++ '05] Pin
jantimmerman3-Apr-06 21:27
jantimmerman3-Apr-06 21:27 
Questionmad libs Pin
jwacho52-Apr-06 11:59
jwacho52-Apr-06 11:59 
QuestionCFileDialog doesn't update when I change the file type. Pin
IlanTal1-Apr-06 19:46
IlanTal1-Apr-06 19:46 
Questionconvert System::String to char Pin
leonelsr1-Apr-06 9:21
leonelsr1-Apr-06 9:21 
AnswerRe: convert System::String to char Pin
2bee 1-Apr-06 12:00
2bee 1-Apr-06 12:00 
Questionargs in the "new" main() Pin
leonelsr31-Mar-06 11:48
leonelsr31-Mar-06 11:48 
AnswerRe: args in the &amp;quot;new&amp;quot; main() Pin
2bee 31-Mar-06 23:00
2bee 31-Mar-06 23:00 
Questionlooping through strings C++ .NET Pin
richiebaby31-Mar-06 4:05
richiebaby31-Mar-06 4:05 
AnswerRe: looping through strings C++ .NET Pin
Saksida Bojan31-Mar-06 5:34
Saksida Bojan31-Mar-06 5:34 
GeneralRe: looping through strings C++ .NET Pin
richiebaby31-Mar-06 5:51
richiebaby31-Mar-06 5:51 
GeneralRe: looping through strings C++ .NET Pin
Saksida Bojan31-Mar-06 6:51
Saksida Bojan31-Mar-06 6:51 
GeneralRe: looping through strings C++ .NET - Figured it out Pin
richiebaby31-Mar-06 6:54
richiebaby31-Mar-06 6:54 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.