Avatar of josephdaviskcrm
josephdaviskcrm
Flag for United States of America asked on

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

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?
.NET ProgrammingC#

Avatar of undefined
Last Comment
josephdaviskcrm

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
CMYScott

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
josephdaviskcrm

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

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
josephdaviskcrm

ASKER
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.
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
philipjonathan

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.
SOLUTION
philipjonathan

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
CMYScott

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?

josephdaviskcrm

ASKER
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.
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
philipjonathan

Did you try that after you add the reference to System.Data.dll?
CMYScott

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
josephdaviskcrm

ASKER
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. :-)
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck