Hello All,
I have patient_table in the database. which contain Id, name ,Image & other fields
I have inserted the image in the Byte form in the database.
Now i want to display all records in the Datagrid view in windows Form.
i am able to display id & Name & all fields but unable to display the image of a patient in the datagrid view
I put all the records in the generic list:-
i am unable to write the code for displaying the image on data gridview
I am unable to find the solution for binding the image field in the datagrid view.
Please help me as soon as possible.
I have patient_table in the database. which contain Id, name ,Image & other fields
I have inserted the image in the Byte form in the database.
Now i want to display all records in the Datagrid view in windows Form.
i am able to display id & Name & all fields but unable to display the image of a patient in the datagrid view
I put all the records in the generic list:-
public static List<Personal_Details> AllMembers()
{
List<Personal_Details> listMembers = new List<Personal_Details>();
Personal_Details pDetails;
try
{
String Constring = ConnectionString.dataBaseConnectionString;
OleDbConnection conn = new System.Data.OleDb.OleDbConnection(Constring);
string query = @"Select * from member_table";
OleDbCommand cmd = new OleDbCommand(query, conn);
conn.Open();
OleDbDataReader reader = cmd.ExecuteReader();
while (reader.Read())
{
pDetails = new Personal_Details();
pDetails.memberId = Int64.Parse(reader["memberId"].ToString());
pDetails.addressStreet = reader["addressStreet"].ToString();
pDetails.addressArea = reader["addressArea"].ToString();
pDetails.addressCity = reader["addressCity"].ToString();
pDetails.state = reader["state"].ToString();
pDetails.pincode = reader["pincode"].ToString();
pDetails.category = reader["category"].ToString();
pDetails.DOB = reader["DOB"].ToString();
pDetails.education = reader["education"].ToString();
pDetails.memberFirstName = reader["memberFirstName"].ToString();
pDetails.memberLastName = reader["memberLastName"].ToString();
pDetails.memberMiddleName = reader["memberMiddleName"].ToString();
pDetails.imageByte = (Byte[])(reader["image"]);
// pDetails.mobileNo=Double.Parse(reader["mobile_no"].ToString());
//pDetails.profession=reader["profession"].ToString();
//pDetails.role=reader["role"].ToString();
pDetails.sex=reader["sex"].ToString();
// pDetails.subRole=reader["subrole"].ToString();
listMembers.Add(pDetails);
}
reader.Close();
conn.Close();
}
catch (Exception ex)
{
}
return listMembers;
}
private void ListAllMembers_Load(object sender, EventArgs e)
{
List<Personal_Details> listAllMembers = Personal_Details.AllMembers();
dgvAllMembers.DataSource = listAllMembers;
}
i am unable to write the code for displaying the image on data gridview
I am unable to find the solution for binding the image field in the datagrid view.
Please help me as soon as possible.