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

DbManager Class

I have a DbManager class that has all my connect stuff like connecting to the
bd and inserting data, but for some reason when I call the insert coammand
for the DbManager class I get A Method 'Network_Inventory.DbManager.Insert()'
referenced without parentheses

Here is my DbManager Class code
public void Insert()
{
OleDbCommand cmdInsert = new OleDbCommand();
cmdInsert.ExecuteNonQuery();
}
Here is my save btn that calls it
private void btnSave_Click(object sender, System.EventArgs e)
{
DbManager manager = new DbManager();
manager.conn();
manager.Insert = "insert into Wired(RouterName) values ('" +
txtRouterName.Text + "')";
}
Can some one help
Nov 16 '05 #1
2 7211
It looks like you're using Insert as a property when it's actually a method,
see inline:

"freddy" <fr****@discussions.microsoft.com> wrote in message
news:72**********************************@microsof t.com...
I have a DbManager class that has all my connect stuff like connecting to
the
bd and inserting data, but for some reason when I call the insert coammand
for the DbManager class I get A Method
'Network_Inventory.DbManager.Insert()'
referenced without parentheses

Here is my DbManager Class code
public void Insert()
{
OleDbCommand cmdInsert = new OleDbCommand();
cmdInsert.ExecuteNonQuery();
}
Here is my save btn that calls it
private void btnSave_Click(object sender, System.EventArgs e)
{
DbManager manager = new DbManager();
manager.conn();
manager.Insert = "insert into Wired(RouterName) values ('" +
txtRouterName.Text + "')";
should be:
manager.Insert("insert into Wired(RouterName) values ('" +
txtRouterName.Text + "')");
}
Can some one help


Just a work of warning, using the above code leaves you wide open to SQL
injection attacks. Whenever possible you should use parameters instead of
just concatenating strings.
Nov 16 '05 #2
BTW, the code you posted could potentially open you up to SQL Injection
attacks. You might consider using parameterized queries instead.

Thx

"freddy" <fr****@discussions.microsoft.com> wrote in message
news:72**********************************@microsof t.com...
I have a DbManager class that has all my connect stuff like connecting to
the
bd and inserting data, but for some reason when I call the insert coammand
for the DbManager class I get A Method
'Network_Inventory.DbManager.Insert()'
referenced without parentheses

Here is my DbManager Class code
public void Insert()
{
OleDbCommand cmdInsert = new OleDbCommand();
cmdInsert.ExecuteNonQuery();
}
Here is my save btn that calls it
private void btnSave_Click(object sender, System.EventArgs e)
{
DbManager manager = new DbManager();
manager.conn();
manager.Insert = "insert into Wired(RouterName) values ('" +
txtRouterName.Text + "')";
}
Can some one help

Nov 16 '05 #3

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

Similar topics

1
by: Murat Tasan | last post by:
hi, i am having a small problem with constructing an inner class. i am using an inner class (and not a static nested class) because the methods of the inner class need access to the enclosing...
2
by: Fernando Rodriguez | last post by:
Hi, I need to traverse the methods defined in a class and its superclasses. This is the code I'm using: # An instance of class B should be able to check all the methods defined in B #and A,...
2
by: Gabriel Genellina | last post by:
Hi In the following code sample, I have: - a Worker class, which could have a lot of methods and attributes. In particular, it has a 'bar' attribute. This class can be modified as needed. - a...
1
by: Oplec | last post by:
Hi, I'm learning C++ as a hobby using The C++ Programming Language : Special Edition by Bjarne Stroustrup. I'm working on chpater 13 exercises that deal with templates. Exercise 13.9 asks for me...
9
by: Banaticus Bart | last post by:
I wrote an abstract base class from which I've derived a few other classes. I'd like to create a base class array where each element is an instance of a derived object. I can create a base class...
5
by: Andy | last post by:
Hi all, I have a site with the following architecture: Common.Web.dll - Contains a CommonPageBase class which inherits System.Web.UI.Page myadd.dll - Contains PageBase which inherits...
1
by: Crercio O. Silva | last post by:
We are pleased to announce the release of the new DBManager 2.3.0. This versions is not only a bug fix but it has new features which make the application more powerful. Starting in this version...
3
by: Hamilton Woods | last post by:
Diehards, I developed a template matrix class back around 1992 using Borland C++ 4.5 (ancestor of C++ Builder) and haven't touched it until a few days ago. I pulled it from the freezer and...
0
by: emin.shopper | last post by:
I had a need recently to check if my subclasses properly implemented the desired interface and wished that I could use something like an abstract base class in python. After reading up on metaclass...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: 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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

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.