Click here to Skip to main content
15,900,258 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
how to use convert method in the c# coding to convert money to string before executing the insert query
Posted

If you're doing inserts into a database by concatenating string values you may want to look at parameterized queries instead, this would allow you to use the values as they are without casting them to strings while also reducing the scope for sql injection attacks.

Use SQL Parameters to Overcome Ad Hoc Performance Issues[^]
SQL injection attacks[^]
 
Share this answer
 
double to string

double money=1144.50
string smoney=money.toString();

string to double


money=convert.todouble(smoney);
 
Share this answer
 
How about something like:

float foo = 1.23;
string ba = foo.ToString();
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900