By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,515 Members | 1,061 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,515 IT Pros & Developers. It's quick & easy.

to set a database connection string at run time

P: n/a
Hello,

I want to set a database connection string at run time. To do that, I want
to open the "data link property" window.
I knew how to do that in VB6 (I used the MSDASC.DataLinks object).

But with dotnet, I cannot find the good reference.

Any help will be appreciated.
Thanks
Nov 20 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Hi Serge,

When you use a form, the most simple place to set it is in the load event of
the form, that works with the designer made connectionstrings as well.
(In that case do not remove the original by the designer created
connectionstring because than by changing things you are in trouble)

Something as

myconnection.connectionstring = "connectionstring"

I hope this helps?

Cor
Hello,

I want to set a database connection string at run time. To do that, I want
to open the "data link property" window.
I knew how to do that in VB6 (I used the MSDASC.DataLinks object).

But with dotnet, I cannot find the good reference.

Any help will be appreciated.
Thanks

Nov 20 '05 #2

P: n/a
Hello again, ...

I have found that link that corresponds to what I want to do :
http://www.codeguru.com/vb/gen/vb_da...cle.php/c5139/

The corresponding VB code :

Imports MSDASC
Imports ADODB

Public Class Form1
Inherits System.Windows.Forms.Form

[ Windows Form Designer generated code ]

Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click

Dim Instance As DataLinksClass = New DataLinksClass
Dim connection As ConnectionClass = New ConnectionClass
If (Instance.PromptEdit(connection)) Then
TextBox1.Text = connection.ConnectionString
End If

End Sub
End Class

The problem is that there is an error with the 2 imports. How to set these
references ?

Thanks.


"Serge Fournier" <sa********@free.fr> a écrit dans le message de
news:%2****************@TK2MSFTNGP10.phx.gbl...
Hello,

I want to set a database connection string at run time. To do that, I want
to open the "data link property" window.
I knew how to do that in VB6 (I used the MSDASC.DataLinks object).

But with dotnet, I cannot find the good reference.

Any help will be appreciated.
Thanks

Nov 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.