[Newbie] Im getting an error "Fatal Error Encountered During Command Execution" and empty file path
Hello im getting an error and i dont know why. it says "Empty File path is not Legel " Right after that "Fatal Encountered During Command Execution." Here is my code along with its image conversion. i'm also trying to put image through update statement here is it
(` try {
string myConnection = "datasource=localhost; port=3306; username=root;password=admin; database=dbstudents;";
MySqlConnection myConn = new MySqlConnection(myConnection);
//Images Conversion : Datatype in my database is LONGBLOB
byte[] img = string.IsNullOrEmpty(imgLoc) ? null : File.ReadAllBytes(imgLoc);
FileStream fs = new FileStream(imgLoc, FileMode.Open, FileAccess.Read);
BinaryReader br = new BinaryReader(fs);
img = br.ReadBytes((int)fs.Length);
// this is a smaple query for update statement and update
string Query = "UPDATE tblstudent RIGHT JOIN tbltransact ON tblstudent.StudentID = tbltransact.EnrolleeID SET FirstName=@firstName , LastName=@lastName , MiddleName=@middleName ,ContactNo=@contactNo ,Address=@address ,Age=@age ,Guardian=@guardian,studentPic=@studentPic,PendingBalance=@pendingBalance, WHERE StudentID=@studentID";
MySqlCommand cin = new MySqlCommand(Query, myConn);
myConn.Open();
cin.Parameters.AddWithValue("@studentID", int.Parse(search.Text));
cin.Parameters.AddWithValue("@firstName", firstname.Text);
cin.Parameters.AddWithValue("@lastName", lastname.Text);
cin.Parameters.AddWithValue("@middleName", middlename.Text);
cin.Parameters.AddWithValue("@contactNo", ContactNum.Text);
cin.Parameters.AddWithValue("@address", address.Text);
cin.Parameters.AddWithValue("@age", int.Parse(age.Text));
cin.Parameters.AddWithValue("@guardian", guardian.Text);
cin.Parameters.AddWithValue("@studentPic", @img );
cin.Parameters.AddWithValue("@pendingBalance", Convert.ToInt16(Balance.Text));
cin.ExecuteNonQuery();
myConn.Close();
}catch(Exception ex)
{
MessageBox.Show(ex.Message);
} `)
please help thanks in advance