C#: Bind DataGridView to a database file in the application directory?

Combine the application's startup path with the expected filename.

Combine the application's startup path with the expected filename: string filename = System.IO.Path. Combine(Application. StartupPath, "datafile.

Db"); This will include the path to the executable wherever it is run. You can then use this filename variable as the Database property on the SQLiteConnection object: System.Data.SQLite. SQLiteConnection conn = new System.Data.SQLite.

SQLiteConnection(); // ... your connection setup code here conn. Database = filename; Update: To bind the grid via code see this MSDN article. It applies to MSSQL but SQLite inherits from the Data namespace classes to the objects are interchangeable.

Yes, but the problem is I bind to the db via the VS GUI so all the code to access the db is auto generated - I don't write it myself. – halfpint Mar 30 at 8:32 If you change the generated code it will be okay on recompile, but it will be overwritten when you rerun the GUI's connection wizard. Sadly the only way around is to setup the connection via code.

I recommend it, you will learn more and well worth your time :-) – Wesley Mar 30 at 9:13 Thank you. – halfpint Mar 30 at 10:18.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions