0
Answer

storing db field values into an string array

sachi vasishta

sachi vasishta

15y
3.4k
1

Hi,
I will retrive some field values from two db tables as shown in the below query and I want to store them in a string array. How can I store the selected field values
string sql = string.Format("select scheduleappointment.patientid as Patient_Id,firstname as FirstName,lastname as LastName,phonemobile as Mobile_Phone,phonehome as Home_Phone,scheduledate as Date,starttime as StartTime,endtime as EndTime,provider as Doctor,reason as Reason,priority as Priority,sex as Sex,address as Address,city as City,statecode as State,scheduleid as SId from patientinfo,scheduleappointment where scheduledate='{0}' and scheduleappointment.patientid=patientinfo.patientid order by starttime", mysqldate);
 
Assume that the above query retrieves  6 tuples(rows) then how shall I store these field values in a string array. And after that baesd on starttime I am going to insert a new row for the dgv if it matches with the value in the if condition else I will insert a empty row for that time slot(It is similar to my post on "how to insert cells to dgv statically"). Can anyone help me to accomplish this with code
 
thanks