Link to home
Create AccountLog in
Avatar of josephdaviskcrm
josephdaviskcrmFlag 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?
ASKER CERTIFIED SOLUTION
Avatar of CMYScott
CMYScott
Flag of United States of America image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of josephdaviskcrm

ASKER

Well, I was able to find the stringbuilder class, but the other two I'm still not having any luck with.
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
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.
SOLUTION
Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
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?

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?
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
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. :-)