Link to home
Start Free TrialLog in
Avatar of murfinp
murfinp

asked on

sqlite c# datareader

Hi

I have the following code

                tickDB = new SQLiteConnection("Data Source =" + @txbData.Text);
                tickDB.Open();
                tickCommand = new SQLiteCommand();
                tickCommand.Connection = tickDB;
                tickCommand.CommandText = "SELECT DATE,TIME,LAST,BID,ASK FROM TICKS;";

                tickReader = tickCommand.ExecuteReader();

                    while (tickReader.Read())
                    {
                        string aaa = tickReader.GetString(0);
                        string bbb = tickReader.GetString(1);
                     }

it seems to be reading fine ... loops through fine but in the debugger when i try and look at string aaa or string bbb it says not in the current conext? Am I going crazy?

Thanks
ASKER CERTIFIED SOLUTION
Avatar of Alexandre Simões
Alexandre Simões
Flag of Switzerland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of murfinp
murfinp

ASKER

Hi

I actually also tried that and had the same problem????

Are you able to prompt the values?
If this is a console application you could try a Console.WriteLine(aaa); to see if it works correctly.

If so, you "only" have a VS debugger problem.
Avatar of murfinp

ASKER

ok thanks ... i'll have a play ... a bit of a weird one ...
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
The using()  blocks will automatically dispose the object in () when execution leaves the scope of the enclosing brackets ({}).  even if there is an exception
Avatar of murfinp

ASKER

Thanks guys ... the real problem was I was running in the IDE in release mode! doh!