Hi my name is vishal.
For past 3 days i have breaking my head on how to change format of date field to be displayed in pdf report from c# windows forms
i have been using itextsharp to create pdf report from c# windows forms
Given below is my sql select query in c#.
private void button1_Click(object sender, EventArgs e)
{
SqlConnection conn = new SqlConnection("Data Source=NPD-4\\SQLEXPRESS;Initial Catalog=DRRS;Integrated Security=true");
SqlCommand cmd = new SqlCommand("Select d.dialyserID,r.errorCode,r.dialysis_date,pn.patient_first_name,pn.patient_last_name,d.manufacturer,d.dialyzer_size,r.start_date,r.end_date,d.packed_volume,r.bundle_vol,r.disinfectant,t.Technician_first_name,t.Technician_last_name from dialyser d,patient_name pn,reprocessor r,Techniciandetail t where pn.patient_id=d.patient_id and r.dialyzer_id=d.dialyserID and t.technician_id=r.technician_id and d.deleted_status=0 and d.closed_status=0 and pn.status=1 and r.errorCode<106 and r.reprocessor_id in (Select max(r.reprocessor_id) from reprocessor r where r.dialyzer_id=d.dialyserID) order by pn.patient_first_name,pn.patient_last_name", conn);
conn.Open();
SqlDataReader dr;
dr = cmd.ExecuteReader();
}
The above query works OK.
As you can i export multiple datas from different tables into sql query given below:
I have one date field named:
r.dialysis_date which is from another table named:
reprocessor Given below is structure of table:
reprocessor in sql server2008.
ColumnName DataType AllowNulls
reprocessor_id Int No(auto-increment primary key)
start_date datetime Yes
end_date datetime Yes
row_upd_date datetime Yes
dialysis_date date Yes
bundle_vol Int Yes
disinfectant Int Yes
technician_id Int Yes
user_id Int Yes
dialyzer_id nvarchar(20) Yes
prime_volume Int Yes
What i want is since i am exporting multiple datas from different tables from a button click and i have only 1date field name:
r.dialysis_date in sql select query given above.
When i execute the query above i get date value along with 12:00:00AM which i dont want(time to be displayed at all)
example: 15-MAR-14(some date) 12:00:00AM
i want only 15-Mar-14 only to be displayed in my report not along with 15-MAR-14
12:00:00AM
What i want when i execute the sql select query above I want
r.dialysis_date value to be displayed in format:
dd-MMM-YYYY
I have tried every thing i know to achieve my required result in c#.
Can anyone help me to achieve my required result? Any help or guidance in solving this problem would be greatly appreciated.I hope i get a reply.