3
I need some help with the code below... I need to make the Float value pulled from the SQL Database in the Brazilian format of the Real Number Set in a C# (WPF) project in a Combobox (as Double). That is, bring it as String in Intemssource and not stay in this format "0.000", but in this "0,000".
Code:
var query_Fardo = from f in oDB.tabProdutos
where f.Codigo == Convert.ToInt32(txtCodigoApontaPrd.Text)
select f.Fardo;
CmBox_FardoApontaPrd.ItemsSource = query_Fardo;
CmBox_FardoApontaPrd.ItemStringFormat = "0,000";//Não funciona
Grateful for the support...
Since Cmbox_fardoapontaprd is a String you need to convert Float to String... But it needs to appear as Double (Real number)... The value is type "0,000" ex.: 1,020; 1,920... Understand?
– Felipe Cavalcante
This f.Fardo.Tostring("#,###.###") method has no SQL supported conversions.
– Felipe Cavalcante
oDB
is of what type?– rubStackOverflow
Use LINQ to SQL...in Table tableProducts the Bale column is Float... And so pull: Trssystemdataclassesdatacontext oDB = new Trssystemdataclassesdatacontext()
– Felipe Cavalcante
Does that help? I don’t understand when you ask the type oDB... I use SQL Server
– Felipe Cavalcante
Try to convert into a list with this issue your previous:
var oProdutos = (from Selecao in oDB.tabProdutos orderby Selecao.Descricao select Selecao).ToList<tabProduto>();
then try to.ToString("#,###.###");
– rubStackOverflow
Didn’t work out! :(
– Felipe Cavalcante