Click here to Skip to main content
15,892,005 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
hi,,,, frnds i am creating the online assessment i am getting the error namespace or reference missing in the program

What I have tried:

String sid, sname;
            sid = ddlSubjects.SelectedItem.Value;
            sname = ddlSubjects.SelectedItem.Text;
            Examination exam = new Examination(Int32.Parse(Session["mid"].ToString()), Int32.Parse(sid), sname);  here i am getting the error 
            exam.GetQuestions();
            Session.Add("questions", exam);
            Response.Redirect("examination.aspx");
Posted
Updated 20-Aug-17 20:02pm

1 solution

You have an Examination class in a namespace somewhere, but if you don't tell the compiler in which namespace to look, it won't know where to find that class and it will give an error.

You can either prepend the namespace to Examination (i.e. replacing Examination with Namespace.Examination, where Namespace is an actual namespace, which may contain dots).

Or, instead of that, you can add that namespace on top of your file with a using statement:
C#
using NamespaceContainingExamination; // actual namespace name there
And after that, you can just use Examination like you did.

Namespaces (C# Programming Guide) | Microsoft Docs[^]
using Directive (C# Reference) | Microsoft Docs[^]
 
Share this answer
 

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