en esta linea me da este error:
Código
drFormat["LI"] = drOriginal["LI"].ToString("N0");// Error 1 Ninguna sobrecarga para el método 'ToString' toma '1' argumentos.
Código
private DataTable LoadFormat(DataTable dataTable)
{
DataTable dtFormat = new DataTable();
dtFormat = new DataTable();
//Si te fijas le puedes poner los nombres con espacios asi
// Si tu grilla autogenera las columnas pues ya saldrán en el formato adecuado
dtFormat.Columns.Add("Cod.Producto", typeof(string));
dtFormat.Columns.Add("Descripcion", typeof(string));
dtFormat.Columns.Add("BC", typeof(string));
dtFormat.Columns.Add("BR", typeof(string));
dtFormat.Columns.Add("EX", typeof(string));
dtFormat.Columns.Add("LI", typeof(string));
//SqlCommand cm2 = new SqlCommand("select Codigo=rtrim(cubo.invtid),Descr=rtrim(i.descr),BC=rtrim(cubo.bc),BR=rtrim(cubo.br),EX=rtrim(cubo.ex),LI=rtrim(cubo.li) from inventory i, cubo_stock_bc_li cubo where i.invtid=cubo.invtid and i.glclassid='" + linea + "' and i.transtatuscode='ac' ", cn);
if (dataTable != null)
{
foreach (DataRow drOriginal in dataTable.Rows)
{
DataRow drFormat = dtFormat.NewRow();
drFormat["Cod.Producto"] = drOriginal["Codigo"].ToString();
drFormat["Descripcion"] = drOriginal["Descr"].ToString();
//Esto solo es un ejemplo, pero servirá para que logres el formato adecuado
//drFormat["BC"] = ((DateTime)(drOriginal["FECHA_MODIFICACION"])).ToShortDateString();
drFormat["BC"] = string.Format("{0:##,###}", drOriginal["BC"]);
drFormat["BR"] = string.Format("{0:##,###}", drOriginal["BR"]);
drFormat["EX"] = string.Format("{0:##,###}", drOriginal["EX"]);
//drFormat["LI"] = string.Format("{0:##,###}", drOriginal["LI"]);
drFormat["LI"] = drOriginal["LI"].ToString("N0");// Error 1 Ninguna sobrecarga para el método 'ToString' toma '1' argumentos.
dtFormat.Rows.Add(drFormat);
}
}
return dtFormat;
}
saludos
Ayuda PLS!










Autor


En línea




