0

Basically I want to know if it is possible to connect my VB app with SQL server on the same Computer (Local) and interrogate it for a list of database names.

I just want to know if that is possible.

sqlConn.ConnectionString = Data Source=local;Initial Catalog=unknownDatabase;User Id=knownUsername;Password=knownPassword;"

Fill DataBase Names to Drop Down

User Selects DB Name

Change Connection to now Known DatabaseName

1

1 Answer 1

2

Of course it is possible.. You can create a connection to a local SQL instance the same way you'd create a connection to a remote one.

Then to get a list of the databases on the server, execute "SELECT Name FROM master.sys.databases"

Sign up to request clarification or add additional context in comments.

3 Comments

When I try creating a connection to SQl, it asks for the database name tho..?
@UPGRAYEDD try setting initialcatalog=master, since you know master has to exist.
cool, Ill go ahead and code it tonight and try it at work in the morning, Thanks!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.