Re: overloaded constructors
- From: Dustin Campbell <dustinc@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 5 Jan 2007 16:29:13 +0000 (UTC)
This is probably fairly simple but i can't get it to work. I have a
database wrapper that i created to encapsulate the ado functionality.
I have 1 constructor that does not take any parameters and now i want to
create another constructor that takes an SqlTransaction as a parameter
and then i want it to call the first constructor to do the work that
needs to be done. How do i do this....
this is what i have so far
public ADODatabaseWrapper()
{
// get the connection string from the application settings
connectionString =
eSolutions.AssetManagement.ORMMappingProject.Properties.Settings.Defau
lt.DatabaseConnectionString;
}
public ADODatabaseWrapper(SqlTransaction transaction)
{
if(transaction != null)
{
this.transaction = transaction;
}
}
I think i have to do something like :this( pass in value) but how do i
pass my value in???
It sounds to me like you want to do this:
public ADODatabaseWrapper()
{
// get the connection string from the application settings
connectionString = eSolutions.AssetManagement.ORMMappingProject.Properties.Settings.Default.DatabaseConnectionString;
}
public ADODatabaseWrapper(SqlTransaction transaction): this()
{
if(transaction != null)
{
this.transaction = transaction;
}
}
Best Regards,
Dustin Campbell
Developer Express Inc.
.
- Follow-Ups:
- Re: overloaded constructors
- From: esebastian
- Re: overloaded constructors
- References:
- overloaded constructors
- From: esebastian
- overloaded constructors
- Prev by Date: Re: Authenticate user in OpenLDAP with username and password
- Next by Date: Re: Data Component, Data Layer
- Previous by thread: overloaded constructors
- Next by thread: Re: overloaded constructors
- Index(es):
Relevant Pages
|