hi,
I faced this problem when I tried to insert data into the database.
public CustomMessage SaveIssue(Issue issue)
{
if (issue.Id == 0) return InsertIssue(issue);
else return UpdateIssue(issue);
}
public CustomMessage InsertIssue(Issue issue)
{
string fieldNames = "(Sl_no,Date,NamePrdOrRep,NameOfDepartment,TitleOfProduction,TapeType,PurposeShooting,PurposePreview,QuantityOfTape,BoxNo,BoxName,TapeNo,IssueOrReturn)";
the error message is shown this line execution
string fieldValues = "Values( '" + issue.Sl_no.Replace("'", "''") + "', '" + issue.Date + "', '" + issue.NamePrdOrRep.Replace("'", "''") + "', '" + issue.Department.Replace("'", "''") + "', '" + issue.TitleOfProduction.Replace("'", "''") + "', '" + issue.TapeType.Replace("'", "''") + "', '" + issue.PurposeShooting.Replace("'", "''") + "', '" + issue.PurposePreview.Replace("'", "''") + "', " + issue.QuantityOfTape + ", '" + issue.BoxNo.Replace("'", "''") + "', '" + issue.BoxName.Replace("'", "''") + "', '" + issue.TapeNo.Replace("'", "''") + "', '" + issue.IssueOrReturn.Replace("'", "''") + "' )"; string sqlText = "INSERT INTO [Issue] " + fieldNames + fieldValues;
dbOperations = new DBOperations();
CustomMessage customMessage = dbOperations.ExecuteQuery(sqlText);
if (customMessage.MsgId == 0) customMessage.MsgText = "Successfully Saved.";
return customMessage;
}