Error 1 'AdvoDiary.DataSet' is a 'namespace' but is used like a 'type' D:\AdvoDiary\AdvoDiary\ReportViewer\rptBilling.cs 25 9 AdvoDiary

namespace AdvoDiary.ReportViewer

public partial class rptBilling : Form


    Common sCom;
    DBHelper myDB;
    string sOLE;
    clsGlobalVar objGlob;
    OleDbConnection cn;
    OleDbDataAdapter sDA;
    DataSet sDS;
    OleDbCommand cmd;

Dani AI

Generated

— that compiler message literally means the compiler has resolved the simple name DataSet to a namespace (AdvoDiary.DataSet) instead of the ADO.NET type you expect. This happens when a file, folder, or generated typed DataSet creates a nested namespace called DataSet inside your AdvoDiary project; the C# name-resolution rules then treat the identifier as a namespace, not System.Data.DataSet. (learn.microsoft.com)

Quick checks to find the collision:

  • Use Visual Studio Find in Files (Ctrl+Shift+F) for namespace DataSet, namespace AdvoDiary.DataSet, DataSet.Designer.cs, and *.xsd.
  • Check the DataSet .xsd designer or any generated code — Visual Studio/xsd.exe can generate typed DataSet classes under a namespace that may match your project name. (learn.microsoft.com)

Fix options (ordered by preference):

  • Rename the conflicting namespace or change the typed-dataset/XSD namespace so you don’t hide framework types (best long-term fix).
  • Change the generated XSD/Typed DataSet namespace (or adjust the generator parameters) so the class isn’t under AdvoDiary.DataSet. (learn.microsoft.com)
  • Short-term: fully qualify the type or add an alias in the file that needs the DataSet type:
System.Data.DataSet ds = new System.Data.DataSet();
using MyDS = System.Data.DataSet;

MyDS ds = new MyDS();

Using an alias or full qualification works immediately, but renaming the conflicting namespace avoids future confusion. For how using aliases work and when they’re appropriate, see the C# using/alias guidance. (learn.microsoft.com)

As suggested, inspect the DataSet namespace contents; as implied, more code/context helps—if the above doesn’t find the collision, post the file list or the .xsd/designer snippet so the exact generated namespace can be identified.

Recommended Answers

All 2 Replies

While the code is very sparce, the error message tells you what is wrong. In the namespace AdvoDiary, DataSet is a namespace. I would suggest you look inside DataSet for the type that you want.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.