0 Replies - 516 Views - Last Post: 24 May 2012 - 04:15 AM Rate Topic: -----

#1 csharpdeveloper  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 24-May 12

sqlite lock error using c#,database file locked

Posted 24 May 2012 - 04:15 AM

Hi All,

I am developing c# application, in which backend is sqlite. c# application is running as windows service in server.To work with UI we using flex as front end .http server is used for communication.Now let me explain my problem,

When CRUD operation is performed say like open image editor window and add images and save.First when we access image editor window in front end one URL will be passed to the server which gets the data from database and shows the existing data in the ediyor window, later we make changes and save the changes , it takes too much time to perform the action and at last it ends with database file is locked error.sqlite lock error.But we close the editor window and perform the action again it works.Please help me to find out a solution from this locak error.I am adding my code snippet below,
if (Request.UriParts.Length == 4)
         string fieldname = Request.UriParts[3];
         FieldDefinition fd = (FieldDefinition)thing.type.fields[fieldname];

          // requested field is binary
         if (fd.TypeId == FieldDataType.Binary)
              BinaryField bf = thing.GetBinaryField(fieldname);//get the data from database...
And later we perform the save action...
sqlExpr ="UPDATE field SET [email protected] WHERE itemid [email protected] AND language [email protected] AND fieldid [email protected]";
                                    using (_updateCmd = new SQLiteCommand())
                                        _updateCmd.CommandText = sqlExpr;
                                        _updateCmd.Parameters.AddWithValue("@colvalue", colvalue);
                                        _updateCmd.Parameters.AddWithValue("@language", language);
                                        _updateCmd.Parameters.AddWithValue("@Id", Id);
                                        _updateCmd.Parameters.AddWithValue("@fieldId", fieldId);
                                        fieldRowsAffected += db.ExecuteNonQuerySQL(_updateCmd);

Thanks in advance

Is This A Good Question/Topic? 0
  • +

Page 1 of 1