Link to home
Start Free TrialLog in
Avatar of RBertora
RBertoraFlag for United Kingdom of Great Britain and Northern Ireland

asked on

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

ASKER CERTIFIED SOLUTION
Avatar of AndrewK
AndrewK

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jlach
jlach

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
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
sorry about the doulbe post!