Help please: Physical file/Datasource name vs. aliased name
Posted: Fri 01 Apr 2011 21:11
Please note: I'm fairly new to VB.net and dotConnect (about two weeks), but have previously coded in VB6. Please keep this in mind as you read this and formulate a reply to my question.
When I coded in VB6, I used a wrapper called dhRichClient to talk with my database. One of the things dhRichClient allows when creating a database is something I've been unsuccessful with in dotConnect: Assigning an alias to the database.
I'm using ConnectionStringBuilder and using the example shown in the dotConnect documentation, but with my path and filename for the datasource. Essentially:
I know that since the file does not exist, invoking sqLiteConnection1.Open() will create the file specified by connSB.DataSource. When tables are added, they are added to "database" under this scheme.
But: Suppose I want the database to have an alias (lets say, "DBAlias" for sake of example). How would I go about this so that when I do my transactions later in the application, I can use the alias instead? In other words:
instead of
I could do this with dhRichClient, and while my knowledge is limited, I know it is not endemic to that wrapper. So how do I accomplish this with dotConnect? The end result must be one where the application creates and configures the database, and generates the tables the first time it is run. Am I on the wrong track altogether?
In case it matters, I'm using VB.net 2008 and the standard (free) version of dotConnect (3.10.121, I believe --which brings up a different question: How do I poll the wrapper to return its version?)
Thanks!
When I coded in VB6, I used a wrapper called dhRichClient to talk with my database. One of the things dhRichClient allows when creating a database is something I've been unsuccessful with in dotConnect: Assigning an alias to the database.
I'm using ConnectionStringBuilder and using the example shown in the dotConnect documentation, but with my path and filename for the datasource. Essentially:
Code: Select all
Dim connSB As SQLiteConnectionStringBuilder
connSB.DataSource = "D:\TestApplication\database.db"
connSB.FailIfMissing = false
connSB.Locking = LockingMode.Exclusive
connSB.AutoVacuum = AutoVacuumMode.Full
connSB.ConnectionTimeout = 20
Dim sqLiteConnection1 As SQLiteConnection(connSB.ConnectionString)
But: Suppose I want the database to have an alias (lets say, "DBAlias" for sake of example). How would I go about this so that when I do my transactions later in the application, I can use the alias instead? In other words:
Code: Select all
SELECT [Desc] FROM [DBAlias] WHERE [InStock]=1;
Code: Select all
SELECT [Desc] FROM [database] WHERE [InStock]=1;
In case it matters, I'm using VB.net 2008 and the standard (free) version of dotConnect (3.10.121, I believe --which brings up a different question: How do I poll the wrapper to return its version?)
Thanks!