I use ADO disconnected mode to get data from database by filling dataset ds. All data come true except the date field
string strDate = ds.Tables[0].Rows[0][\
--->cause of this issue
the date of hijri in DateTime Object in c# is between 01/01/1318 and 30/12/1500.
in gregorian date is between years 1900 and 2077
so if we open the sql database and get the date and convert to hijri date we note that is not between the 2 hijri date above
to make sure you can convert it by opening any converter site online
---->solutions
you have 2 solution to resolve this issue
-solusion 1
you can update the values of date in sql
set it to real date (between 1900 and 2077)
OR
-solution 2
in your code before you get the date from datatable row you should to set the CurrentCulture to "en" and when you finish the code you should set the language to "ar".
check the code below
bool isLanguageChanged = false;
if (Thread.CurrentThread.CurrentCulture.Name == "ar")
{
isLanguageChanged = true;
Thread.CurrentThread.CurrentCulture = new CultureInfo("en");
Thread.CurrentThread.CurrentUICulture = new CultureInfo("en");
}
string dateStr = dataTable.Rows[i]["DateColumn"].ToString();
if (isLanguageChanged)
{
Thread.CurrentThread.CurrentCulture = new CultureInfo("ar");
Thread.CurrentThread.CurrentUICulture = new CultureInfo("ar");
}