How to test DataLayer.DataSources connection string


Author
Message
Jeff Pagley
Jeff Pagley
StrataFrame User (469 reputation)StrataFrame User (469 reputation)StrataFrame User (469 reputation)StrataFrame User (469 reputation)StrataFrame User (469 reputation)StrataFrame User (469 reputation)StrataFrame User (469 reputation)StrataFrame User (469 reputation)StrataFrame User (469 reputation)
Group: StrataFrame Users
Posts: 223, Visits: 893
After executing the following code, is there a way to immediately test the connection to make sure my settings are correct before running the app?

Dim builder As New System.Data.SqlClient.SqlConnectionStringBuilder()

builder("Data Source") = My.Settings.DataSource

builder("Initial Catalog") = My.Settings.Database

builder("User ID") = My.Settings.UserID

builder("Password") = My.Settings.Password

DataLayer.DataSources.Add(New SqlDataSourceItem("", builderCMPR.ConnectionString))

"Test connection here...............If fails, possibly using a try/catch show a user friendly error message and gracefully exit the app." 

Thanks for the help!


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search