Sadly, i have to deal with a .dbf file or database if you want, in the server side and i have one question. Since the .dbf is on the server side more users can access it(read and write, i use C# and OdbcConnection). Should i use lock whenever i make insert/update?
I will answer to my own question because i want to paste a piece of code. I have a base class for simple operations
void ExecuteNonQuery(string sqlStatement)
T ExecuteScalar<T>(string sqlStatement)
List<T> GetDataTable<T>(string sqlStatement) where T:new()
public class BaseService
{
protected void ExecuteNonQuery(string sqlStatement)
{
using (OdbcConnection odbconn = new OdbcConnection(ConnectionString))
{
odbconn.Open();
OdbcCommand cmd = new OdbcCommand(sqlStatement, odbconn);
cmd.ExecuteNonQuery();
}
}
}
public class UsersService : BaseService
{
public void SomeInsert()
{
string insertUserString = "Insert Into....";
ExecuteNonQuery(insertUserString);
return true;
}
}
I don;t know if it the best solution but those operations were all i need. I am kinda confused how to use lock here.