Home All Groups Group Topic Archive Search About

How to change the ConnectionString for an auto generated typed dataset in a separate dll ???

Author
16 Mar 2006 12:46 PM
mateo
So here i've made a typed dataset in vs2005 by picking some tables in
the server explorer. It generated a typed dataset with everything
inside it ok. Now i've decided to put this newly created dataset in a
common dll project to share it accross many applications that need the
exact (or almost) set of data.
The problem is if you look into the datatableadapter class created
you'll see something like this:

        Private Sub InitConnection()
            Me._connection = New System.Data.SqlClient.SqlConnection
            Me._connection.ConnectionString =
Global.MyEngine.MySettings.Default.MyConnectionString
        End Sub

My engine dll as no settings or app.conf files. So how can i change
this behavior in order to point to a connection string in the executing
application ?
And is there a way of manually setting this connection string ?
Why is the connection property marked as Friend ?

Thanks in advance
mateo

Author
16 Mar 2006 3:13 PM
W.G. Ryan - MVP
You can edit that code.  Make Connection a private property and stick your
connection string in a config file (encrypted) and just set the property.
Change the code to reference the property you create in the class instead of
the connection string it's getting.

BTW, it looks like you're using a configuration file now, that's where the
MyConnectionString is coming from - do you have a Settings.settings file
somewhere in the app?  That's where it's probably coming from unless I miss
something.  What version of VS is this btw, is it the final release or one
of the betas?
Show quote
"mateo" <tanguay.math***@gmail.com> wrote in message
news:1142513160.263432.14160@e56g2000cwe.googlegroups.com...
> So here i've made a typed dataset in vs2005 by picking some tables in
> the server explorer. It generated a typed dataset with everything
> inside it ok. Now i've decided to put this newly created dataset in a
> common dll project to share it accross many applications that need the
> exact (or almost) set of data.
> The problem is if you look into the datatableadapter class created
> you'll see something like this:
>
>        Private Sub InitConnection()
>            Me._connection = New System.Data.SqlClient.SqlConnection
>            Me._connection.ConnectionString =
> Global.MyEngine.MySettings.Default.MyConnectionString
>        End Sub
>
> My engine dll as no settings or app.conf files. So how can i change
> this behavior in order to point to a connection string in the executing
> application ?
> And is there a way of manually setting this connection string ?
> Why is the connection property marked as Friend ?
>
> Thanks in advance
> mateo
>

AddThis Social Bookmark Button