Click here to Skip to main content
15,914,820 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Error:-
A using namespace directive can only be applied to namespaces; 'System.Data.SqlClient.SqlDataReader is type not namespace...


error cannot understand so plz please help me....
Posted
Updated 12-Jun-12 1:38am
v2
Comments
Prasad_Kulkarni 12-Jun-12 7:41am    
Question also cannot understand, without any code snippets.
Elaborate what you're doing, post your code explain with line number where you got error. Then we can try to help you out. This seems to be namespace error.
RDBurmon 13-Jun-12 9:34am    
Thanks Everyone who replied to this thread , So Member**********, I think you have got enough responses and you should be able to mark it as your answer and close the thread. Please do so.

in your name spaces section use the following code
using System.Data.SqlClient;

instead of
using System.Data.SqlClient.SqlDataReader;
 
Share this answer
 
The error is pretty explicit:
"System.Data.SqlClient.SqlDataReader is type not namespace"
You don't put
C#
using System.Data.SqlClient.SqlDataReader;
in your code: all you need is:
C#
using System.Data.SqlClient;
and then you can access the SqlDataReader directly:
C#
SqlDataReader reader = mySqlCommand.ExecuteReader();
 
Share this answer
 
I think the error message it explanatory itself. You are trying to state something like this in codebehind:

C#
using CLASS NAME;


or
XML
<add namespace="CLASS NAME" />
in web.config file.

As it says, System.Data.SqlClient.SqlDataReader is not a namespace but a class. Good Luck!
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900