The data display in datagrid

retkehing

Well-known member
Joined
Feb 5, 2006
Messages
153
Programming Experience
Beginner
I have successfully tried to link the datagrid with access database by using dataset, but i am looking for a more easier way without an intermediate object or dataset.

Besides, i defined the data souce through connection string because i have no idea on definition of root path database. Whenever i link the system with the database in the properties, it would definitely generate a link path with the drive letter until the inner directory. This will become a problem if i move the system from one platform to another platform while a different path conflict may arise. Any solution for the above two questions? Thank you.
 
Private Shared assemblyFolder As String = System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase
Private Shared DatabasePath As String = assemblyFolder.Substring(assemblyFolder.LastIndexOf(":/") - 1, assemblyFolder.LastIndexOf("/") - assemblyFolder.LastIndexOf(":/") + 1) + "/YourDatabase.mdb"

this code will find out your exe (your system exe) folder path, so put your database same folder with the exe.

Hope can help you~
 
Back
Top