[Newbie] Im getting an error "Fatal Error Encountered During Command Execution" and empty file path
Posted by: Lester Bautista
Date: March 10, 2018 09:28PM

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);

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));

}catch(Exception ex)
} `)
please help thanks in advance

Options: ReplyQuote

Written By
[Newbie] Im getting an error "Fatal Error Encountered During Command Execution" and empty file path
March 10, 2018 09:28PM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.