• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 4966
  • Last Modified:

The type or namespace name 'DataSet' could not be found

I found my error below: <%@Import!!!!!!!
this question will be left for reference.
sorry,


The type or namespace name 'DataSet' could not be found (are you missing a using directive or an assembly reference?)

WHY WHY WHY? I have copied out a simple example from a book,

<%@ Page language = "C#"  runat="server" %>
<%Import Namespace = "System.Data" %>
<%Import Namespace = "System.Data.OleDb" %>
<%Import Namespace = "System.Xml" %>


<script language = "C#"  runat="server">
     void Page_Load()
     {

               string xmlfile = @"C:\inetpub\wwwroot\begaspnet\ch02\artists.xml";
               DataSet DataSet1 = new DataSet();
               DataSet1.ReadXml(xmlfile);
               DataGrid1.DataSource= DataSet1;
               DataGrid1.DataBind();
     }  
</script>

<html>
  <head>
    <title></title>
  </head>
  <body>
  <asp:DataGrid id = "Datagrid1" runat = "server" />
  </body>
</html>

 ------------------------
<?xml version = "1.0"?>
<ARTIST>
  <ITEM>
     <NAME>Vincent Van Gogh</NAME>
     <NATIONALITY>Dutch</NATIONALITY>
     <MOVEMENT>Post Impressionism</MOVEMENT>
     <BIRTHDATE>30th March 1853</BIRTHDATE>
  </ITEM>
  <ITEM>
     <NAME>Paul Klee</NAME>
     <NATIONALITY>Swiss</NATIONALITY>
     <MOVEMENT>Abstract Expressionism</MOVEMENT>
     <BIRTHDATE>18th Decemer 1879</BIRTHDATE>
  </ITEM>
  <ITEM>
     <NAME>Max Ernst</NAME>
     <NATIONALITY>German</NATIONALITY>
     <MOVEMENT>Surrelalism</MOVEMENT>
     <BIRTHDATE>2nd April 18991</BIRTHDATE>
  </ITEM>
</ARTIST>
 ------------------------

DataSet DataSet1 = new DataSet(); - produces the error

The type or namespace name 'DataSet' could not be found (are you missing a using directive or an assembly reference?)

0
RBertora
Asked:
RBertora
  • 3
1 Solution
 
AndrewKCommented:
Isn't C# supposed to use the keyword "using" and VB.NET uses the keyword "imports" with respect to namespaces unless it is in the global.asax file? And shouldn't "Namespace" be lower-case "n" - "namespace"?
0
 
jlachCommented:
Qualify it with the full namespace.. System.Data.DataSet .. and to answer Andrews Q.. yes c# is using System.Data and vb is Imports System.Data .. but try using the full namespace.. that might help
0
 
jlachCommented:
Qualify it with the full namespace.. System.Data.DataSet .. and to answer Andrews Q.. yes c# is using System.Data and vb is Imports System.Data .. but try using the full namespace.. that might help
0
 
jlachCommented:
sorry about the doulbe post!
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now