|
-
Feb 16th, 2007, 01:00 AM
#1
Thread Starter
Just Married
[RESOLVED] [2.0] get the connection string
Hi all
I want to get the connection string from the config file
but i am confused here
I make a code in the VB.NET but what about the c#
See my code in the VB.NET
VB Code:
Public Property ConnectionStringName() As String
Get
Return _ConnectionStringName
End Get
Set(ByVal value As String)
If value Is Nothing Or value = "" Then
Throw New Exception("Can not set null value in Connection String!!!")
End If
_ConnectionStringName = value
_ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings(value).ConnectionString
End Set
End Property
-
Feb 16th, 2007, 01:36 AM
#2
Re: [2.0] get the connection string
VB Code:
public string ConnectionStringName
{
get
{
return _ConnectionStringName;
}
set
{
if (value == null || value == "")
{
throw new Exception("Can not set null value in Connection String!!!");
}
_ConnectionStringName = value;
_ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings(value).ConnectionString;
}
}
-
Feb 16th, 2007, 02:26 AM
#3
Thread Starter
Just Married
-
Feb 16th, 2007, 01:28 PM
#4
Re: [2.0] get the connection string
Sorry my mistake, it should be [] instead of ()
VB Code:
_ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings[B][[/B]value[B]][/B].ConnectionString;
-
Feb 17th, 2007, 12:52 AM
#5
Thread Starter
Just Married
Re: [2.0] get the connection string
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|