sivakumarl Posted March 4, 2004 Posted March 4, 2004 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 Quote
Administrators PlausiblyDamp Posted March 4, 2004 Administrators Posted March 4, 2004 Have you added a reference to system.data.dll? Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
sivakumarl Posted March 4, 2004 Author Posted March 4, 2004 yes ! it was there added by default but i added the reference again still it is giving me the error Quote
Administrators PlausiblyDamp Posted March 4, 2004 Administrators Posted March 4, 2004 Does it work if you use 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. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
sivakumarl Posted March 4, 2004 Author Posted March 4, 2004 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 does't 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 name'CommadType' not found" Please tell me why my using statements are not inheriting I request you to extend your cooperation. Thank you Quote
sivakumarl Posted March 4, 2004 Author Posted March 4, 2004 The connection string in the above code is "Data Source=localhost;Initial Catalog=NorthWind;User Id=siva;Pwd=siva" Quote
Administrators PlausiblyDamp Posted March 4, 2004 Administrators Posted March 4, 2004 You have using System.Data.SqlClient but you don't have using System.Data at the top - therefore you will have to fully qualify DataSet, CommandType etc. (or add in the relevant using directive) Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
sivakumarl Posted March 4, 2004 Author Posted March 4, 2004 OH!!!!!!!!!! Thank you Very much for your coperation I appreciate your help Thank you Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.