Hi,
I want to save NULL in database for column while upload file is empty.
Here is my code,
cmd.Parameters.AddWithValue("@sp_ID", tx_id.Text.ToString());
cmd.Parameters.AddWithValue("@sp_Upload_file", String.IsNullOrEmpty(FileUpload1.FileName) ? (object)DBNull.Value : FileUpload1.FileName);
cmd.Parameters.AddWithValue("@sp_Link_file", String.IsNullOrEmpty(FileUpload1.FileName) ? (object)DBNull.Value :
"http://.../public/Attachment/" + tx_id.Text.ToString() + "/" + FileUpload1.FileName);
In this scenario database not saving as NULL value but the error is
Exception Details: MySql.Data.MySqlClient.MySqlException:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1
Please help me to do this.