Question

I'm trying to make a C# (Windows Forms) application which utilizes SQLite. Anyway, my code is this :

try
{
    db.Insert("COLUMN_NAME", data);
}
catch (Exception e)
{
    //MessageBox.Show(e.Message);    
}

I made COLUMN_NAME unique, so it throws an SQL error, intentionally. But I don't want to see the error message in a MessageBox, so I commented out the MessageBox.Show() line, but still the error message pops up. Is it a property of try / catch ? If so, how can I prevent it ?

P.S.

I know there are better ways to do this task, but it is not important. I just want to learn how to get rid of error messages in exceptions.

Thanks for any help !

Was it helpful?

Solution

I figured the problem. The line db.Insert(); itself has a try/catch block, which shows a MessageBox.

I found the code here by the way.

Thanks again for all the help !

OTHER TIPS

There is RunTime error in your line at

db.Insert("COLUMN_NAME", data);

So you need to fix this.

Try by clean and then build your code. Then run the code. Sometimes dll file is not refreshed. It will be regeneratedby clean and build your code.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top