We help IT Professionals succeed at work.

ASP.NET - VB objects that are not available in C#

josephdaviskcrm
on
186 Views
Last Modified: 2013-12-17
I'm somewhat of a beginner when it comes to programming, and I would consider myself more on top of writing code in VB.NET than in C#.NET.

So I am very used to using the objects in VB: System.Data.SqlClient.DataTable and DataSet.  But these don't seem to be available in C#.  Yes I have added the using System.Data.SqlClient; to the top of the file.

Also, I'm familiar with the StringBuilder object in VB, but it doesn't seem to be available either.  Is that part of a class library that I need to import as well?
Comment
Watch Question

Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Author

Commented:
Well, I was able to find the stringbuilder class, but the other two I'm still not having any luck with.

Commented:
you'll want to make sure you have a reference to System.Data in your project, then add

using System.Data;

to the beginning of any file you want to make use of DataTable and/or DataSet

if you still have problems, it might help if you could post some of your code

Author

Commented:
I'm not sure what you mean about making reference to System.Data in my project.  The project is a web application and it automatically had the following at the top of each form that I create:

using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.IO;
using System.Data.SqlClient;
using System.Text;

apart from the last three, which I added myself.  I'm not sure what other code I can post that would help.
To add reference:
1. From VS menu choose Project -> Add Reference
2. Add Reference dialog will be shown.
3. Under the .NET tab, search for System.Data.dll.
4. Click Select
5. Click OK.
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Commented:
philip has the right idea - that's really the code I was looking for, not the usings

can we see an example where you declare and use a DataTable or DataSet?

Author

Commented:
I don't have any code where I'm trying to declare either one.  When I try the intellisence doesn't give me the option for them.  Thats how I know that I don't have access to them.
Did you try that after you add the reference to System.Data.dll?

Commented:
how about you post what you think it should be - for two reasons

1.  its not uncommon for certain namespaces to get messed up with intellisense

2.  we can make sure you are using the correct syntax

Author

Commented:
OK, this is stupid... I was trying to type SqlDataTable and SqlDataSet.  DataTable and DataSet work fine.  Sorry guys.  Thats what I get for staying up as late as I was. :-)

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.