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

Type 'ConnectionStringData' is not defined.

P: n/a
I'm migrating a VB.NET 2003 application to VB.NET 2008. The 2003 app used the
June 2005 Enterprise Library while I'm going to use the latest EntLib, 4.0 -
May 2008.

I copied the 2003 app to a new 2008 folder structure, recreated the
app.config using the new 4.0 EntLib config tool, and referenced the 4.0
Microsoft.Practices.EnterpriseLibrary.Data.dll file.

The problem is there is a Function that has errors in it and I'm not sure
how to fix these.

Here are the lines of code and their respective errors:

Dim authConnectString As ConnectionStringData
Error: Type 'ConnectionStringData' is not defined.

authConnectString =
dbSettings.ConnectionStrings.Item(String.Concat(Co mmon.Constants.AuthDbInstanceName, "_CS"))
Error: 'ConnectionStrings' is not a member of
'Microsoft.Practices.EnterpriseLibrary.Data.Config uration.DatabaseSettings'.

authInstance = New InstanceData(Common.Constants.AuthDbInstanceName)
Error: Argument not specified for parameter 'sample' of 'Public Sub
New(instanceName As String, sample As System.Diagnostics.CounterSample)'.

There are a few more. Please contact me and I'll send you the Function so
you can take a look at it.

--
Thanks,
Dave B.
Jun 27 '08 #1
Share this Question
Share on Google+
8 Replies


P: n/a
dmbuso-

Have a look at this one, which is a special VB method

http://msdn.microsoft.com/en-us/libr...11(VS.80).aspx

-Cor

"dmbuso" <dm*****@community.nospamschreef in bericht
news:E9**********************************@microsof t.com...
I'm migrating a VB.NET 2003 application to VB.NET 2008. The 2003 app used
the
June 2005 Enterprise Library while I'm going to use the latest EntLib,
4.0 -
May 2008.

I copied the 2003 app to a new 2008 folder structure, recreated the
app.config using the new 4.0 EntLib config tool, and referenced the 4.0
Microsoft.Practices.EnterpriseLibrary.Data.dll file.

The problem is there is a Function that has errors in it and I'm not sure
how to fix these.

Here are the lines of code and their respective errors:

Dim authConnectString As ConnectionStringData
Error: Type 'ConnectionStringData' is not defined.

authConnectString =
dbSettings.ConnectionStrings.Item(String.Concat(Co mmon.Constants.AuthDbInstanceName,
"_CS"))
Error: 'ConnectionStrings' is not a member of
'Microsoft.Practices.EnterpriseLibrary.Data.Config uration.DatabaseSettings'.

authInstance = New InstanceData(Common.Constants.AuthDbInstanceName)
Error: Argument not specified for parameter 'sample' of 'Public Sub
New(instanceName As String, sample As System.Diagnostics.CounterSample)'.

There are a few more. Please contact me and I'll send you the Function so
you can take a look at it.

--
Thanks,
Dave B.
Jun 28 '08 #2

P: n/a
Cor,

Thanks for the article. I read it, but I don't think this is really the
route I should go. I viewed the app.config with XML Notepad and I think what
I need to do is to read the 'connectionStrings' node contained in the
app.config.

Here's what it looks like in XML Notepad:

<connectionStrings>
<add name="LocalAuth_CS" connectionString="Server=.;Integrated
Security=True" providerName="System.Data.SqlClient"/>
<add name="RAID_CS" connectionString="Database=RAID;Server=.;Integrate d
Security=False;User ID=RaidApp;Password="";Connect Timeout=30"
providerName="System.Data.SqlClient"/>
<add name="RAIDAuth_CS" connectionString="Database=RAID;Server=.;Integrate d
Security=True" providerName="System.Data.SqlClient"/>
</connectionStrings>

Also and as a side note, I created the app.config with the EntLib 4.0 config
tool.

This function is giving me an error also. It is telling me that that
GetConfiguration is not a member of Sytem.Configuration.ConfigurationManager.
I think this is where I need to read the connection strings.

Private Shared Function ReadDBSettings() As DatabaseSettings
Return
CType(ConfigurationManager.GetConfiguration("dataC onfiguration"),
DatabaseSettings)
End Function
Here is my email: Da***************@usdoj.gov
and Work Phone: (814) 532-4925
--
Dave B.
"Cor Ligthert[MVP]" wrote:
dmbuso-

Have a look at this one, which is a special VB method

http://msdn.microsoft.com/en-us/libr...11(VS.80).aspx

-Cor

"dmbuso" <dm*****@community.nospamschreef in bericht
news:E9**********************************@microsof t.com...
I'm migrating a VB.NET 2003 application to VB.NET 2008. The 2003 app used
the
June 2005 Enterprise Library while I'm going to use the latest EntLib,
4.0 -
May 2008.

I copied the 2003 app to a new 2008 folder structure, recreated the
app.config using the new 4.0 EntLib config tool, and referenced the 4.0
Microsoft.Practices.EnterpriseLibrary.Data.dll file.

The problem is there is a Function that has errors in it and I'm not sure
how to fix these.

Here are the lines of code and their respective errors:

Dim authConnectString As ConnectionStringData
Error: Type 'ConnectionStringData' is not defined.

authConnectString =
dbSettings.ConnectionStrings.Item(String.Concat(Co mmon.Constants.AuthDbInstanceName,
"_CS"))
Error: 'ConnectionStrings' is not a member of
'Microsoft.Practices.EnterpriseLibrary.Data.Config uration.DatabaseSettings'.

authInstance = New InstanceData(Common.Constants.AuthDbInstanceName)
Error: Argument not specified for parameter 'sample' of 'Public Sub
New(instanceName As String, sample As System.Diagnostics.CounterSample)'.

There are a few more. Please contact me and I'll send you the Function so
you can take a look at it.

--
Thanks,
Dave B.

Jun 30 '08 #3

P: n/a
Hi Dave,

Since the project is converted from VS 2003 to VS 2008 and it has changed
much from .NET framework 1.1 to 2.0(or 3.5), especially for the
configuration management architecture, it is possible that many such
configuration related code will get broken.

As for the code snippet you provided:

===================
>authConnectString =
dbSettings.ConnectionStrings.Item(String.Concat(C ommon.Constants.AuthDbInst
anceName, "_CS"))
>Error: 'ConnectionStrings' is not a member of
'Microsoft.Practices.EnterpriseLibrary.Data.Confi guration.DatabaseSettings'
Jul 1 '08 #4

P: n/a
Huh?

PS - I'm using framework 3.5 also.
--
Dave B.
"Steven Cheng [MSFT]" wrote:
Hi Dave,

Since the project is converted from VS 2003 to VS 2008 and it has changed
much from .NET framework 1.1 to 2.0(or 3.5), especially for the
configuration management architecture, it is possible that many such
configuration related code will get broken.

As for the code snippet you provided:

===================
authConnectString =
dbSettings.ConnectionStrings.Item(String.Concat(Co mmon.Constants.AuthDbInst
anceName, "_CS"))
Error: 'ConnectionStrings' is not a member of
'Microsoft.Practices.EnterpriseLibrary.Data.Config uration.DatabaseSettings'
Jul 1 '08 #5

P: n/a
Thanks for your reply Dave,

Yes, .NET 2.0 and .NET 3.5 doesn't have much difference, however, since
your original code is coupled with .NET framework 1.1, the framework and
enterprise library for that framework has changed much. Therefore, I
suggeset you check any of those classes which is no longer used in the new
framework or new enterprise library and replace them with the new syntax or
code style. Have you tried changing the database accessing code as I
mentioned in previous message to see whether the error disappears?

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
>From: =?Utf-8?B?ZG1idXNv?= <dm*****@community.nospam>
References: <E9**********************************@microsoft.co m>
<nF**************@TK2MSFTNGHUB02.phx.gbl>
>Subject: RE: Type 'ConnectionStringData' is not defined.
Date: Tue, 1 Jul 2008 05:09:03 -0700
>
Huh?

PS - I'm using framework 3.5 also.
--
Dave B.
"Steven Cheng [MSFT]" wrote:
>Hi Dave,

Since the project is converted from VS 2003 to VS 2008 and it has
changed
>much from .NET framework 1.1 to 2.0(or 3.5), especially for the
configuration management architecture, it is possible that many such
configuration related code will get broken.

As for the code snippet you provided:

===================
>authConnectString =
dbSettings.ConnectionStrings.Item(String.Concat(C ommon.Constants.AuthDbInst
>anceName, "_CS"))
>Error: 'ConnectionStrings' is not a member of
'Microsoft.Practices.EnterpriseLibrary.Data.Confi guration.DatabaseSettings'
>>
Jul 2 '08 #6

P: n/a
Steven,

No I haven't tried your supposed code change because your response is the
same as what I had. Could you please repost it?

Here is the line of code and the error it yields:

authConnectString =
dbSettings.ConnectionStrings.Item(String.Concat(Co mmon.Constants.AuthDbInstanceName, "_CS"))

Error: 'ConnectionStrings' is not a member of
'Microsoft.Practices.EnterpriseLibrary.Data.Config uration.DatabaseSettings'.

--
Dave B.
"Steven Cheng [MSFT]" wrote:
Thanks for your reply Dave,

Yes, .NET 2.0 and .NET 3.5 doesn't have much difference, however, since
your original code is coupled with .NET framework 1.1, the framework and
enterprise library for that framework has changed much. Therefore, I
suggeset you check any of those classes which is no longer used in the new
framework or new enterprise library and replace them with the new syntax or
code style. Have you tried changing the database accessing code as I
mentioned in previous message to see whether the error disappears?

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
From: =?Utf-8?B?ZG1idXNv?= <dm*****@community.nospam>
References: <E9**********************************@microsoft.co m>
<nF**************@TK2MSFTNGHUB02.phx.gbl>
Subject: RE: Type 'ConnectionStringData' is not defined.
Date: Tue, 1 Jul 2008 05:09:03 -0700

Huh?

PS - I'm using framework 3.5 also.
--
Dave B.
"Steven Cheng [MSFT]" wrote:
Hi Dave,

Since the project is converted from VS 2003 to VS 2008 and it has
changed
much from .NET framework 1.1 to 2.0(or 3.5), especially for the
configuration management architecture, it is possible that many such
configuration related code will get broken.

As for the code snippet you provided:

===================
authConnectString =
dbSettings.ConnectionStrings.Item(String.Concat(Co mmon.Constants.AuthDbInst
anceName, "_CS"))
Error: 'ConnectionStrings' is not a member of
'Microsoft.Practices.EnterpriseLibrary.Data.Config uration.DatabaseSettings'
>

Jul 2 '08 #7

P: n/a
Thanks for your reply Dave,

Oh, my omit. I just found that my first reply got truncated due to some
tool issue. I'll compose a new one and post here soon. Really sorry for the
misleading and inconvenience.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
>From: =?Utf-8?B?ZG1idXNv?= <dm*****@community.nospam>
References: <E9**********************************@microsoft.co m>
<nF**************@TK2MSFTNGHUB02.phx.gbl>
<4C**********************************@microsoft.co m>
<iE**************@TK2MSFTNGHUB02.phx.gbl>
>Subject: RE: Type 'ConnectionStringData' is not defined.
Date: Wed, 2 Jul 2008 05:06:01 -0700
>Steven,

No I haven't tried your supposed code change because your response is the
same as what I had. Could you please repost it?

Here is the line of code and the error it yields:

authConnectString =
dbSettings.ConnectionStrings.Item(String.Concat(Co mmon.Constants.AuthDbInsta
nceName, "_CS"))
>
Error: 'ConnectionStrings' is not a member of
'Microsoft.Practices.EnterpriseLibrary.Data.Confi guration.DatabaseSettings'
Jul 3 '08 #8

P: n/a
Hi Dave,

In my first reply, I mentioned some suggestion about the two problems you
said in your initial messsage.

1. About the ConnectionStringData. It is apparently that, from .net
framework 2.0, this class type will not be used (also for the new
enterprise library). And since .net framework 2.0 application's app.config
file has built-in connection string support, the entlib will also utlize
it. The typical code that establish database connection and perform command
operation is like below:

=========================
Public Function UpdateProducts() As Integer
' Create the Database object, using the default database service.
The
' default database service is determined through configuration.
Dim db As Database = DatabaseFactory.CreateDatabase()

Dim productsDataSet As DataSet = New DataSet

Dim sqlCommand As String = "Select ProductID, ProductName,
CategoryID, UnitPrice, LastUpdate " & _
"From Products"
Dim dbCommand As DbCommand = db.GetSqlStringCommand(sqlCommand)

.........................

=========================

it use a DatabaseFactory to direclty get a DataBase object(the default one
or you can supply a name).

And for the ConfigurationManager class, it doesn't have a
"GetConfiguration" method, only a "GetSection" method is available. You can
refer to the available member list of ConfigurationManager class:

#ConfigurationManager Members
http://msdn.microsoft.com/en-us/libr...onfigurationma
nager_members.aspx

Also, I think you can refer to some of the samples in the enterprise
library 4.0(such as the data access ones) and convert those old style
code(in entlib 1.1) to the new style ones.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
>Subject: RE: Type 'ConnectionStringData' is not defined.
Date: Wed, 2 Jul 2008 05:06:01 -0700
>Steven,

No I haven't tried your supposed code change because your response is the
same as what I had. Could you please repost it?

Here is the line of code and the error it yields:

authConnectString =
dbSettings.ConnectionStrings.Item(String.Concat(Co mmon.Constants.AuthDbInsta
nceName, "_CS"))
>
Error: 'ConnectionStrings' is not a member of
'Microsoft.Practices.EnterpriseLibrary.Data.Confi guration.DatabaseSettings'
..
>
--
Dave B.
"Steven Cheng [MSFT]" wrote:
>Thanks for your reply Dave,

Yes, .NET 2.0 and .NET 3.5 doesn't have much difference, however, since
your original code is coupled with .NET framework 1.1, the framework and
enterprise library for that framework has changed much. Therefore, I
suggeset you check any of those classes which is no longer used in the
new
>framework or new enterprise library and replace them with the new syntax
or
>code style. Have you tried changing the database accessing code as I
mentioned in previous message to see whether the error disappears?

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments
and
>suggestions about how we can improve the support we provide to you.
Please
>feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.
Jul 3 '08 #9

This discussion thread is closed

Replies have been disabled for this discussion.