Search Results

Search found 8 results on 1 pages for 'galford13x'.

Page 1/1 | 1 

  • Exception using SQLiteDataReader

    - by galford13x
    I'm making a Custom SQLite Wrapper. This is meant to allow a presistent connection to a database. However, I receive an exception when calling this function twice. public Boolean DatabaseConnected(string databasePath) { bool exists = false; if (ConnectionOpen()) { this.Command.CommandText = string.Format(DATABASE_QUERY); using (reader = this.Command.ExecuteReader()) { while (reader.Read()) { if (string.Compare(reader[FILE_NAME_COL_HEADER].ToString(), databasePath, true) == 0) { exists = true; break; } } reader.Close(); } } return exists; } I use the above function to check if the database is currently open before executing a command or trying to open a database. The first time I execute the function, it executes with no issue. After that the reader = this.Command.ExecuteReader() throws an exception Object reference not set to an instance of an object. StackTrace: at System.Data.SQLite.SQLiteStatement.Dispose() at System.Data.SQLite.SQLite3.Reset(SQLiteStatement stmt) at System.Data.SQLite.SQLite3.Step(SQLiteStatement stmt) at System.Data.SQLite.SQLiteDataReader.NextResult() at System.Data.SQLite.SQLiteDataReader..ctor(SQLiteCommand cmd, CommandBehavior behave) at System.Data.SQLite.SQLiteCommand.ExecuteReader(CommandBehavior behavior) at System.Data.SQLite.SQLiteCommand.ExecuteReader() at EveTraderApi.Database.SQLDatabase.DatabaseConnected(String databasePath) in C:\Documents and Settings\galford13x\My Documents\Visual Studio 2008\Projects\EveTrader\EveTraderApi\Database\Database.cs:line 579 at EveTraderApi.Database.SQLDatabase.OpenSQLiteDB(String filename) in C:\Documents and Settings\galford13x\My Documents\Visual Studio 2008\Projects\EveTrader\EveTraderApi\Database\Database.cs:line 119 at EveTraderApiExample.Form1.CreateTableDataTypes() in C:\Documents and Settings\galford13x\My Documents\Visual Studio 2008\Projects\EveTrader\EveTraderApiExample\Form1.cs:line 89 at EveTraderApiExample.Form1.Button1_ExecuteCommand(Object sender, EventArgs e) in C:\Documents and Settings\galford13x\My Documents\Visual Studio 2008\Projects\EveTrader\EveTraderApiExample\Form1.cs:line 35 at System.Windows.Forms.Control.OnClick(EventArgs e) at System.Windows.Forms.Button.OnClick(EventArgs e) at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent) at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ButtonBase.WndProc(Message& m) at System.Windows.Forms.Button.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg) at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData) at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context) at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context) at System.Windows.Forms.Application.Run(Form mainForm) at EveTraderApiExample.Program.Main() in C:\Documents and Settings\galford13x\My Documents\Visual Studio 2008\Projects\EveTrader\EveTraderApiExample\Program.cs:line 18 at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args) at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart()

    Read the article

  • C# Problem with Settings.Reload() and Settings.Save() Settings not loading

    - by galford13x
    I have a strange issue that I can't figure out. I have a custom settings class that inherits ApplicationSettingsBase. It has a user scoped settings as shown below. /// <summary> /// The Last Active Account /// </summary> [UserScopedSettingAttribute()] public AccountKeyClass ActiveAccount { get { try { return (AccountKeyClass)this["ActiveAccount"]; } catch(Exception error){} return null; } set { this["ActiveAccount"] = value; if (!this.AccountList.Contains(value)) { //this.AccountList.Add(value); } } } /// <summary> /// Account List /// Key: UserID /// Value: AccountKeyClass /// </summary> [UserScopedSettingAttribute()] public List<AccountKeyClass> AccountList { get { try { if(this["AccountList"] != null) return (List<AccountKeyClass>)this["AccountList"]; } catch(Exception error){} return null; } set { this["AccountList"] = value; } } I have two forms, a Main form and a Settings form in which to change application settings. When I creating the SettingsForm and change AccountList Settings value, the user.config file changes as excepected. My Apply/Ok button for my SettingsForm calls Settings.Save() then Settings.Reload() then closes the form. The problem is that when .Reload() is called, the Settings.AccountList becomes null. Whats more is that the user.config file never changes, if i close the application and reopen, the user.config file is still correct, but the Settings.AccountList is never read in. The Settings.AccountList is read in if i never call the .Reload() however. Update: If I create a List and Save(); from my MainForm, then the AccountList will be read in from my user.config fine. However If I add to the AccountList using my secondary form (SettingsForm) and call Save() then the next time the application is run the settings are not read in and a null value is returned in it's place. This happens even if I do not use Reload(). I think the problem has something to do with using the Generic List<. The AccountKeyClass that is being saved is saved as Serialized XML.

    Read the article

  • Proper way to Dispose of a BackGroundWorker

    - by galford13x
    Would this be a proper way to dispose of a BackGroundWorker? I'm not sure if it is necesary to remove the events before calling .Dispose(). Also is calling .Dispose() inside the RunWorkerCompleted delegate ok to do? public void RunProcessAsync(DateTime dumpDate) { BackgroundWorker worker = new BackgroundWorker(); worker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(worker_RunWorkerCompleted); worker.DoWork += new DoWorkEventHandler(worker_DoWork); worker.RunWorkerAsync(dumpDate); } void worker_DoWork(object sender, DoWorkEventArgs e) { // Do Work here } void worker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { BackgroundWorker worker = sender as BackgroundWorker; worker.RunWorkerCompleted -= new RunWorkerCompletedEventHandler(worker_RunWorkerCompleted); worker.DoWork -= new DoWorkEventHandler(worker_DoWork); worker.Dispose(); }

    Read the article

  • Problem with .NET Settings.Reload() and Settings.Save() Settings not loading

    - by galford13x
    I have a strange issue that I can't figure out. I have a custom settings class that inherits ApplicationSettingsBase. It has a user scoped settings as shown below. /// <summary> /// The Last Active Account /// </summary> [UserScopedSettingAttribute()] public AccountKeyClass ActiveAccount { get { try { return (AccountKeyClass)this["ActiveAccount"]; } catch(Exception error){} return null; } set { this["ActiveAccount"] = value; if (!this.AccountList.Contains(value)) { //this.AccountList.Add(value); } } } /// <summary> /// Account List /// Key: UserID /// Value: AccountKeyClass /// </summary> [UserScopedSettingAttribute()] public List<AccountKeyClass> AccountList { get { try { if(this["AccountList"] != null) return (List<AccountKeyClass>)this["AccountList"]; } catch(Exception error){} return null; } set { this["AccountList"] = value; } } I have two forms, a Main form and a Settings form in which to change application settings. When I creating the SettingsForm and change AccountList Settings value, the user.config file changes as excepected. My Apply/Ok button for my SettingsForm calls Settings.Save() then Settings.Reload() then closes the form. The problem is that when .Reload() is called, the Settings.AccountList becomes null. Whats more is that the user.config file never changes, if i close the application and reopen, the user.config file is still correct, but the Settings.AccountList is never read in. The Settings.AccountList is read in if i never call the .Reload() however. Update: If I create a List and Save(); from my MainForm, then the AccountList will be read in from my user.config fine. However If I add to the AccountList using my secondary form (SettingsForm) and call Save() then the next time the application is run the settings are not read in and a null value is returned in it's place. This happens even if I do not use Reload(). I think the problem has something to do with using the Generic List<. The AccountKeyClass that is being saved is saved as Serialized XML.

    Read the article

  • SQLite is the CASE statement expensive?

    - by galford13x
    I'm wondering if using a CASE statement in SQLite (or other SQL engines) to replace data is not advised. For example lets say I have a query. SELECT Users, CASE WHEN Active = 0 THEN 'Inactive' WHEN Active = 1 THEN 'Active' WHEN Active = 2 THEN 'Processing' ELSE 'ERROR' AS Active FROM UsersTable; When is it better to create a reference table and perform a JOIN. In this case I would create a Table 'ActiveStatesTable' with ActiveID, ActiveDescription and perform the JOIN.

    Read the article

  • Database Design Question regaurding duplicate information.

    - by galford13x
    I have a database that contains a history of product sales. For example the following table CREATE TABLE SalesHistoryTable ( OrderID, // Order Number Unique to all orders ProductID, // Product ID can be used as a Key to look up product info in another table Price, // Price of the product per unit at the time of the order Quantity, // quantity of the product for the order Total, // total cost of the order for the product. (Price * Quantity) Date, // Date of the order StoreID, // The store that created the Order PRIMARY KEY(OrderID)); The table will eventually have millions of transactions. From this, profiles can be created for products in different geographical regions (based on the StoreID). Creating these profiles can be very time consuming as a database query. For example. SELECT ProductID, StoreID, SUM(Total) AS Total, SUM(Quantity) QTY, SUM(Total)/SUM(Quantity) AS AvgPrice FROM SalesHistoryTable GROUP BY ProductID, StoreID; The above query could be used to get the Information based on products for any particular store. You could then determine which store has sold the most, has made the most money, and on average sells for the most/least. This would be very costly to use as a normal query run anytime. What are some design descisions in order to allow these types of queries to run faster assuming storage size isn’t an issue. For example, I could create another Table with duplicate information. Store ID (Key), Product ID, TotalCost, QTY, AvgPrice And provide a trigger so that when a new order is received, the entry for that store is updated in a new table. The cost for the update is almost nothing. What should be considered when given the above scenario?

    Read the article

  • Walking through an SQLite Table

    - by galford13x
    I would like to implement or use functionality that allows stepping through a Table in SQLite. If I have a Table Products that has 100k rows, I would like to retrive perhaps 10k rows at a time. Somthing similar to how a webpage would list data and have a < Previous .. Next > link to walk through the data. Are there select statements that can make this simple? I see and have tried using the ROWID in conjunction with LIMIT which seems ok if not ordering the data. // This seems works if not ordering. SELECT * FROM Products WHERE ROWID BETWEEN x AND y;

    Read the article

  • issue with c# xml documentation

    - by galford13x
    I have the following comment. /// <summary> /// MSDN Time Format compatible with <see cref="DateTime.ParseExact(string, string, IFormatProvider)"/> /// </summary> /// <returns>MSDN Time Format compatible with <see cref="DateTime.ParseExact(string, string, IFormatProvider)"/></returns> but I'm not sure why I receive the following warning Warning 7 XML comment on 'MSLab.DateTime.SystemTimeProvider.GetTimeFormat()' has cref attribute 'DateTime.ParseExact(string, string, IFormatProvider)' that could not be resolved F:\My Documents\Visual Studio 2010\Projects\MSLab\trunk\MSLab\MSLab\DateTime\SystemTimeProvider.cs 110 57 MSLab

    Read the article

1