none
Weird DB Refresh Issue. RRS feed

  • Question

  • Hi,

     

    I'm facing a very weird DB refresh issue.The problem goes like this...

     

    Environment:

    I have a Sybase DB to which i'm connecting via a C# client application.From the application,I'm inserting and querying the DB.Also users can insert/query/Delete in the backend using any of the Sybase Query Analyzers such as SQL Advantage or Sybase Interactive Java Client or using the commandline utility called SQSH in an unix box.

     

    Programming Part:

    For all DB operations i'm using ADO.NET 2.0 libraries from my application...for every operation(insert or querying) i create a connection and closes it..Pseudo code is given below..

     

    Code Block

    public static List<string> GetBookNames()

    {

     

    CreateDBConnection();//Creates a new dbConn object

    List<string> books = new List<string>;

    DbCommand cmd = dbConn.CreateCommand()

    string query = "....";

    cmd.CommandText = query ;

    cmd.Commandtype = Commandtype.Text;

    IDataReader reader = cmd.ExecuteReader();

    int index = reader.GetOrdinal("books");

    while(reader.Read())

    {

    books.Add(reader.GetString(index));

    }

    CloseDBConnection();

    return books;

    }

     

     

     

    ISSUE:

     

    Once the user uses any of the sybase query analyzers and inserts the data via that,and then immedietly comes and clicks on the C# GUI to retrieve it,other than the the last inserted value everything is retrieved.It takes atleast 2 or 3 clicks to retrieve the last inserted value.It is a very simple table a very simple retrieve query from the client.The best part is,it is an intermittent issue.So my BIG question to you all is...

     

    IS THERE A WAY BY WHICH I CAN FORCE A REFRESH ON THE DB USING ADO.NET???

     

    My intution is,the DB is not getting refreshed or is locked for say a particular time interval.So,I need to refresh the DB,before i fetch the data from it.

     

    Any thoughts/views/opinions on this will be highly appreciated.

     

    Thanks,

    Mmx

    Friday, January 11, 2008 12:02 PM