Few things to check:
- put a breakpoint to
Lo_cmd.ExecuteNonQery
, what does this return. The returned number is the number of rows affected. If it's 0 nothing is inserted. - in your catch block, it looks like you're gathering the errors from the connection. Does that gather errors also from the command? When debugging the code check that the code isn't actually hitting the catch block and possibly returning 0 erroneously.
- where is the database file you use. Is it in a static location or is it included in your project. Could it be that when you run the project the database file in debug or release directory gets overwritten with the initial version included with the project.
And yes, do use parameters instead if string concatenations. For example, if the user would write to
TempInfo.Mine_Name
:
Some's name
you would have a statement like:
INSERT INTO tbl_Mine
( MINE_NAME, Mojaveze_Bahrebardari_No, Mojaveze_Bahrebardari_Date, Geo_Location, Personel_No, Capacity)
values ('Some's name',...
That would certainly cause an error.