Welcome to WindowsClient.net | Sign in | Join

Datasets and Connection Strings

In this video training session you'll be shown how to change the Dataset, Table Adapter and runtime. Normally this is a read-only setting but thanks to a tip from Steve Lasker’s blog, we can change the connection string while the program is running.

Author: Pat Tormey

Duration: 12:11

Video Downloads:
WMV | WMV (Zip) | Zune | iPod | PSP | MPEG-4 | 3GP

Audio Downloads:
AAC | WMA | MPEG-4 | MPEG-3 | MPEG-2

Sample Code:
VB | C#

You must Login to comment.Comments: 3

BrianGoodheim: On January 29, 2009 5:45 PM said:

Pat, In creating a writeonly property in settings.vb, I get the following error in the designer:

'Public Property NewConnectionString() As String' and 'Public WriteOnly Property NewConnectionString() As String' cannot overload each other because they differ only by 'ReadOnly' or 'WriteOnly'.

My settings.vb source is...

Partial Friend NotInheritable Class MySettings

       Public WriteOnly Property NewConnectionString() As String

           Set(ByVal value As String)

               My.Settings("TwoTableConnectionString") = value

           End Set

       End Property

   End Class

The following code in settings.designer throws the error...

Public Property NewConnectionString() As String

           Get

               Return CType(Me("NewConnectionString"),String)

           End Get

           Set

               Me("NewConnectionString") = value

           End Set

       End Property

   End Class

Any help would be appreciated.  Thanks ...  -Brian

 

BrianGoodheim: On January 29, 2009 6:22 PM said:

Pat,

I think I figured it out.  Apparently, you cannot define a user setting string in the project.settings table AND define a settings property with the same name in code, or the two declarations will conflict at compile time.  By deleting the user string entry in the project.settings table, the compile error went away and the windows form application runs as expected using the user-provided runtime database connection set in the form_load event.

Thanks again for your helpful video.

    -Brian

 

rthoma10: On January 21, 2010 3:19 PM said:

Hello Pat,

I found this from a comment you left at windowsclient.net/.../video.aspx.  Thank you for this, very useful!

 



Featured Item