I am writing a text file with some data recorded inside a SQL database.
I am writing some data and one of them is a data, and it writes with this shape: dd/mm/yyyy hh:mm:ss
.
How can I make it just writing dd/mm/yyyy
.
Here is the code I am using to write the data in the text file:
if (sqlReader["TaxableGroupID"].Equals(1))
{
tw.WriteLine(sqlReader["PartyFederalTaxID"] + ";" + sqlReader["TransSerial"] + sqlReader["TransDocNumber"] + ";" + sqlReader["CreateDate"] + ";" + sqlReader["TotalAmount"] + "\r\n" + sqlReader["BarCode"] + ";" + "23" + ";" + sqlReader["Quantity"]);
}
I have the same problem with the TotalAmount
. I want to write it with a .
to separate the decimals and it writes with a ,
. I have tested this code but didn’t work. The decimal separator still ,
.
if (sqlReader["TaxableGroupID"].Equals(1))
{
tw.WriteLine(sqlReader["PartyFederalTaxID"] + ";" + sqlReader["TransSerial"] + sqlReader["TransDocNumber"] + ";" + sqlReader["CreateDate"] + ";" + sqlReader["TotalAmount".ToString(CultureInfo.InvariantCulture)] + "\r\n" + sqlReader["BarCode"] + ";" + "23" + ";" + sqlReader["Quantity"]);
}
I tried this to fix the date problem but as the .
problem, I didn’t get any error but the date stood the same.
if (sqlReader["TaxableGroupID"].Equals(1))
{
tw.WriteLine(sqlReader["PartyFederalTaxID"] + ";" + sqlReader["TransSerial"] + sqlReader["TransDocNumber"] + ";" + sqlReader["CreateDate".toString("dd/MM/yyyy")] + ";" + sqlReader["TotalAmount".ToString] + "\r\n" + sqlReader["BarCode"] + ";" + "23" + ";" + sqlReader["Quantity"]);
}