473,382 Members | 1,766 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,382 software developers and data experts.

overloaded constructors

hello all,
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.Prope rties.Settings.Default.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???
Thanks,
Erin

Jan 5 '07 #1
2 1205
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.Prope rties.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.Prope rties.Settings.Default.DatabaseConnectionString;
}

public ADODatabaseWrapper(SqlTransaction transaction): this()
{
if(transaction != null)
{
this.transaction = transaction;
}
}
Best Regards,
Dustin Campbell
Developer Express Inc.
Jan 5 '07 #2
YES!!! thank you...
Seems so silly now that i see it....

Jan 5 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: andrea_gavana | last post by:
Hello NG, I am trying to port a useful class from wxWidgets (C++) to a pure Python/wxPython implementation. In the C++ source code, a unique class is initialized with 2 different methods (???)....
1
by: masood.iqbal | last post by:
I have a few questions regarding overloaded typecast operators and copy constructors that I would like an answer for. Thanks in advance. Masood (1) In some examples that I have seen...
3
by: hazz | last post by:
The following classes follow from the base class ' A ' down to the derived class ' D ' at the bottom of the inheritance chain. I am calling the class at the bottom, "public class D" from a client...
3
by: mblatch | last post by:
This is probably a C#-101 type question, but I've struck out on finding an answer. I am setting up a class with a few overloaded constructors. Inside those constructors, I would like to call the...
3
by: Vera | last post by:
I built a class in VB.NET that has an overloaded constructor. It can either accept nothing, a string or an object Public Sub New( MyBase.New( End Su Public Sub New(ByVal strName As String...
7
by: cmay | last post by:
Can someone quick shed some light on this issue I am having? I wanted to create 2 constructors for my object, one that takes an ID value and one that takes a datarow. If ID value is provided,...
5
by: sam_cit | last post by:
Hi Everyone, I was just wondering, about the overloaded assignment operator for user defined objects. It is used to make sure that the following works properly, obj1 = obj; so the...
3
by: jerry.teshirogi | last post by:
I have the following class and main: ////////////////////////////////////////////////////////// #include <iostream.h> class myVector { public: double x, y, z:
13
by: =?Utf-8?B?QW5kcmVhcw==?= | last post by:
Hi, I would like to get some thoughts on Overloaded constructors vs. Object initializations. Assuming that the class supports a default constructor, is there any reason to include overloaded...
6
by: Joe HM | last post by:
Hello - I have a question regarding overloading the New() in a MustInherit Class. The following show the code in question ... MustInherit Class cAbstract Public MustOverride Sub print() ...
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...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.