SQLDataReader giving only one field

Hello,
Anything incorrect below as i am getting only single field rather then 3 in the datareader. I am just getting StudentID field value only.

SqlCommand getStudent = InitiateDatabaseCommand();

            getStudent.Parameters.Add("@StudentId", SqlDbType.Int);
            getStudent.Parameters["@StudentId"].Value = 1;
            getStudent.CommandText = "Select * From Student  r where r.StudentID=@StudentId AND r.Name like '%R%'";

            SqlDataReader dr = comm.ExecuteReader();

        while (dr.Read()){

           //filling the studentinfo data model object here.
        }
Abhilash Nagar.NET DeveloperAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Nitin SontakkeDeveloperCommented:
//filling the studentinfo data model object here.

You omitted the most significant piece of information from your question. Could you please demonstrate what is it that is being written where you have mentioned the above text?

Also, please show us the structure of the Student table.
Abhilash Nagar.NET DeveloperAuthor Commented:
Thanks for the response. some Syntax was the issue. So i did it but really thanks for the response.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Abhilash Nagar.NET DeveloperAuthor Commented:
I was referring a command object which was incorrect.

Correct command object was SqlCommand comm

I was referring to the SqlCommand testcomm which was running execute scalar.

Thanks for all the responses. Really appreciate your time.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.