   How To Convert Managed String To Value Or Value To Managed String In Visual C++ .Net
  Help me pliz..I got a problem here..I'm working with Visual C++ .Net 2005, when i'm using this code :txtItemPrice->Text=reader->GetDecimal(2);I got this error :Error2error C2664: 'void System::Windows::Forms::Control::Text::set(System::String ^)' : cannot convert parameter 1 from 'System::Decimal' to 'System::String ^'d:\my documents\visual studio 2008\projects\mini_project\mini_project\frmItem.h322mini_projectDoes anybody know how to convert a value into a managed string or how to convert a managed string to a value in Visual C++ .Net..Help Me Pliz.. T.T   
  Every managed type supports the ToString() member function.   ;Quote:Original post by dfx_slayertxtItemPrice->Text=reader->GetDecimal(2);This would look like:txtItemPrice->Text=reader->GetDecimal(2)->ToString();If you want to convert a string into an actual value:String ^myString = "23.5";Decimal myDecimal = Convert::ToDecimal(myString);;  thx bro..It's worked..txtItemPrice->Text=Convert::ToString(reader->GetInt32(2));but didn't work for Decimal Type.. T.TI got a new problem here :sql="INSERT INTO ITEM VALUES('" + txtIDItem->Text->Trim() + "','" + txtItemName->Text->Trim() + "'," + Convert::ToInt32(txtItemPrice->Text) + ",'" + txtItemDescription->Text->Trim() + "')";when i try to execute that sql statement..here is the error i got : "Input String was not in a correct format"In my database :IDItem : TextItemName : TextItemPrice : LongItemDescription : TextCould someone help me pliz.. T.T   ;  Step 1: Write the final SQL query to some debug output where you can see what it is and confirm that it actually makes sense.Step 2: Learn to use the actual database query stuff in the Framework, instead of doing this dangerous string mess.By the way. C++/CLI, which you're using, is a terrible place for a newbie (or any developer, really) to be. Why aren't you using C#? It doesn't sound like you're at all ready to be tackling a language of this complexity and relative obscurity. You'd be much better off in almost ANY other programming language.   ;  I remember having problems with reader.GetDecimal and reader.GetDouble too.Im not sure why they don't work, or why they are not implemented, but I do remember that I ended up with something like this:double d = Convert.ToDouble(reader->GetValue(0))You can try that if everything else fails.As for adding parameters to a query, I prefer to do it this way:...command.CommandText="INSERT INTO ITEM VALUES(@ID, @ItemName, @ItemPrice, @ItemDescription)";command.Parameters.AddWithValue("@ID", txtIDItem->Text->Trim());command.Parameters.AddWithValue("@ItemName", txtItemName->Text->Trim());command.Parameters.AddWithValue("@ItemPrice", Convert::ToInt32(txtItemPrice->Text));command.Parameters.AddWithValue("@ItemDescription", txtItemDescription->Text->Trim());...ps. My syntax may be scewed, I havent compiled itedit:Unless you have a reason to use a string as ID I would suggest either an auto incrementing int, or a guid instead.   