Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Call connected datasource without Dim connection again? 1

Status
Not open for further replies.

cdck

Programmer
Nov 25, 2003
281
US
I'm working on my first VB application. I have a dataset in my datasources which includes tables holding username/password information. When the application opens, I have a login form open first. In the code for this form, I want it to select the appropriate record from the UserInfo table (based on the UserName entered in the form) and compare the user/pass combo to the data from the table, then make a decision about the next action based on that result.

All very simple, I know.

My question is this, however. I already have a connection string for the datasource in the project. I can view it in Settings.Designer.vb.
[tt]
Namespace My
<Global.System.Configuration.ApplicationScopedSettingAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Configuration.SpecialSettingAttribute(Global.System.Configuration.SpecialSetting.ConnectionString), _
Global.System.Configuration.DefaultSettingValueAttribute("Data Source=AD4;Initial Catalog=M2MAydinOther;Integrated Security=True")> _
Public ReadOnly Property M2MAydinOtherConnectionString() As String
Get
Return CType(Me("M2MAydinOtherConnectionString"),String)
End Get
End Property
End Class
End Namespace
[/tt]
Is there anyway I can call that connection string, instead of typing it out in the Login Form coding?

Cheryl dc Kern
 

You should be able to get the connection string like this:

Dim cs As String

cs = My.Settings.M2MAydinOtherConnectionString



I used to rock and roll every night and party every day. Then it was every other day. Now I'm lucky if I can find 30 minutes a week in which to get funky. - Homer Simpson

Arrrr, mateys! Ye needs ta be preparin' yerselves fer Talk Like a Pirate Day!
 
Sorry for the delayed response, I was pulled for an emergency project. Thank you so much for clearing up the proper call-out!

Cheryl dc Kern
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top