473,320 Members | 1,814 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Type 'ConnectionStringData' is not defined.

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
8 1681
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
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
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
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
by: Terje Slettebø | last post by:
Hi. I'm new here, and sorry if this has been discussed before; I didn't find it searching the PHP groups. (I've also read recommendations to cross-post to the other PHP groups, but if that is...
4
by: Jari Kujansuu | last post by:
I can successfully parse XML document using SAX or DOM and I can also validate XML document against schema. Problem is that my program should deal with user-defined schemas which means that when...
4
by: Jacob Jensen | last post by:
This question has probably been asked a million time, but here it comes again. I want to learn the difference between the three type cast operators: static_cast, reinterpret_cast, dynamic_cast. A...
21
by: Nitin Bhardwaj | last post by:
Hi all, It is said that C++ is a strongly typed language and thus a type-safe language (unlike C). So how does one explain the following behaviour : int main(void) { char *p = NULL; p = "A...
8
by: Rade | last post by:
Following a discussion on another thread here... I have tried to understand what is actually standardized in C++ regarding the representing of integers (signed and unsigned) and their conversions....
13
by: dawatson833 | last post by:
I have several stored procedures with parameters that are defined with user defined data types. The time it takes to run the procedures can take 10 - 50 seconds depending on the procedure. If I...
14
by: Matt | last post by:
I want to know if "int" is a primitive type, or an object? For example, the following two approaches yield the same result. > int t1 = int.Parse(TextBox2.Text); //method 1 > int t2 =...
7
by: Michael | last post by:
Hi, I could understand the difference between class and object. However, I could find out a good definiton of type. how to understand the relaitonship between type, class, and object? Thanks! ...
70
by: garyusenet | last post by:
I'm using an example piece of code: - namespace Wintellect.Interop.Sound{ using System; using System.Runtime.InteropServices; using System.ComponentModel; sealed class Sound{ public static...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.