i have a datetime field in sql server table - PAYMENTDATE.
i select this using a stored procedure and populate a dropdownlist in ASP.NET with the values that are returned.
this is the code that i use:
if(ds.Tables[0].Rows.Count!=0)
{
DropDownList1.DataSource = ds;
DropDownList1.DataMember = "CLAIMSPERD_EMF";
DropDownList1.DataTextField = "ACTIVE_PERIOD";
DropDownList1.DataBind();
}
this all works fine but the date appears in the dropdownlist with as a date and time field (the time is 00:00:00) so it might look something like this:
2001-09-30 00:00:00.000
i don't store the time initially in the field and i don't need it either.
is there a way to remove this 00:00:00 from the date in the dropdownlist.
i hae tried Substring(0,8).ToString() on both the left and right sides of the line:
DropDownList1.DataTextField = "ACTIVE_PERIOD";
bu this gives me errors.
in the table in sqlserver the date is stored as 2001-09-30 when i return all rows but if i use query analyser and run a query the date comes back ike 2001-09-30 00:00:00.000
i have tried
any help would be much appreciated!
thanks!
i select this using a stored procedure and populate a dropdownlist in ASP.NET with the values that are returned.
this is the code that i use:
if(ds.Tables[0].Rows.Count!=0)
{
DropDownList1.DataSource = ds;
DropDownList1.DataMember = "CLAIMSPERD_EMF";
DropDownList1.DataTextField = "ACTIVE_PERIOD";
DropDownList1.DataBind();
}
this all works fine but the date appears in the dropdownlist with as a date and time field (the time is 00:00:00) so it might look something like this:
2001-09-30 00:00:00.000
i don't store the time initially in the field and i don't need it either.
is there a way to remove this 00:00:00 from the date in the dropdownlist.
i hae tried Substring(0,8).ToString() on both the left and right sides of the line:
DropDownList1.DataTextField = "ACTIVE_PERIOD";
bu this gives me errors.
in the table in sqlserver the date is stored as 2001-09-30 when i return all rows but if i use query analyser and run a query the date comes back ike 2001-09-30 00:00:00.000
i have tried
any help would be much appreciated!
thanks!