?
Solved

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

Posted on 2003-02-21
6
Medium Priority
?
4,848 Views
Last Modified: 2013-11-19
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
Comment
Question by:RBertora
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
6 Comments
 
LVL 2

Accepted Solution

by:
AndrewK earned 200 total points
ID: 7994134
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
 
LVL 1

Expert Comment

by:jlach
ID: 8017234
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
 
LVL 1

Expert Comment

by:jlach
ID: 8017241
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
 
LVL 1

Expert Comment

by:jlach
ID: 8017253
sorry about the doulbe post!
0

Featured Post

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question