Getting the SeverName and DatabaseName from a project
mkquinn
Posts: 4
how do i Get the SeverName and DatabaseName from a project
here's the code i have
Dim obSqlProvider1 As SqlProvider = New SqlProvider
Dim dbSourceDatabase As Database
Dim dbTargetDatabase As Database
Dim p As Project
'load the project from a file
p = Project.LoadFromDisk(sPath & sFile, True)
'set the database with the connections from the project file
dbSourceDatabase = obSqlProvider1.GetDatabase(p.ConnectionProperties1)
dbTargetDatabase = obSqlProvider1.GetDatabase(p.ConnectionProperties2)
p.ConnectionProperties2 must have the server and database name in them how do i get them out.
also is there any good redgate development books out there?
thanks mick
here's the code i have
Dim obSqlProvider1 As SqlProvider = New SqlProvider
Dim dbSourceDatabase As Database
Dim dbTargetDatabase As Database
Dim p As Project
'load the project from a file
p = Project.LoadFromDisk(sPath & sFile, True)
'set the database with the connections from the project file
dbSourceDatabase = obSqlProvider1.GetDatabase(p.ConnectionProperties1)
dbTargetDatabase = obSqlProvider1.GetDatabase(p.ConnectionProperties2)
p.ConnectionProperties2 must have the server and database name in them how do i get them out.
also is there any good redgate development books out there?
thanks mick
This discussion has been closed.
Comments
You'd think that you should be able to get the database, username, and password out of the connection properties, but all of these things are marked as private so you can't get them back!
Even using SqlProvider.GetDatabase on the connection properties to get a database object will not let you see the connection properties. There aren't any books out there that we know of, maybe I could write one, then I could say I wrote the book on Toolkit development!
Sorry about the poor attempt at humour...