Type or namespace could not found

sivakumarl

Member
Joined
Mar 4, 2004
Messages
6
I have a doubt in c#
while iam doing my c# applications especially ado.net
it says that a "type or namespace could not found."
even though i use using system.data.sqlclient namespace
the same example is ruiing me in vb.net

suppoose if i use a DataSet ds = new DataSet() ;

it says that type or name space of " DataSet" could not found

any body pls help me to clear my query
Thank you
 
Does it work if you use
C#:
System.Data.DataSet ds = new System.Data.DataSet();

also could you paste your using statements here - I noticed in your original post they were in lower case - C# is case sensitive.
 
using System;
using System.Collections;
using System.ComponentModel;
using System.Data.SqlClient;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;

It executed for me Now!!!
Could you please tellme why it does nt take if i give
DataSet ds = new DataSet();
Instead of
System.Data.DataSet ds = new System.Data.DataSet();

my is it not inheriting the default namespace.Is it problem in framework. My framework version is 1.1.4322

and my using statements doest vary from what i gave above.

what about the other statements like SqlDbType ,CommadType ,ParameterDirection,... because these staements also getting the same error when iam using a stored procedure.

i will give a simple example for that

SqlConnection nwindConn = new SqlConnection("Initial Catalog=northwind;Data Source=Pubs;User Id=siva;Pwd=siva");

SqlCommand salesCMD = new SqlCommand("Ten Most Expensive Products" , nwindConn);
salesCMD.CommandType = CommandType.StoredProcedure;

nwindConn.Open();

SqlDataReader myReader = salesCMD.ExecuteReader();

while (myReader.Read())
{
Response.Write(myReader.GetString(0));
Response.Write(myReader.GetDecimal(1));
Response.Write("<br>");
}

Here it is giving the same error like
"type or namespace of nameCommadType not found"

Please tell me why my using statements are not inheriting
I request you to extend your cooperation.
Thank you
 
The connection string in the above code is
"Data Source=localhost;Initial Catalog=NorthWind;User Id=siva;Pwd=siva"
 
You have
C#:
using System.Data.SqlClient
but you dont have
C#:
using System.Data

at the top - therefore you will have to fully qualify DataSet, CommandType etc. (or add in the relevant using directive)
 
Back
Top