Solved

using directives

Posted on 2004-05-03
1
535 Views
Last Modified: 2012-05-04
Getting following errors even thou I have mentioned the using directives:

C:\Trupti\cs555\projreservation\Global.asax.cs(57): The type or namespace name 'sqlCommand' could not be found (are you missing a using directive or an assembly reference?)

C:\Trupti\cs555\projreservation\Global.asax.cs(58): The type or namespace name 'cmd' could not be found (are you missing a using directive or an assembly reference?)

C:\Trupti\cs555\projreservation\Global.asax.cs(59): The type or namespace name 'cmd' could not be found (are you missing a using directive or an assembly reference?)

C:\Trupti\cs555\projreservation\Global.asax.cs(60): The type or namespace name 'sqlDataReader' could not be found (are you missing a using directive or an assembly reference?)

C:\Trupti\cs555\projreservation\Global.asax.cs(63): The type or namespace name 'reader' could not be found (are you missing a using directive or an assembly reference?)

C:\Trupti\cs555\projreservation\Global.asax.cs(64): The name 'reader' does not exist in the class or namespace 'wc4.Global'

C:\Trupti\cs555\projreservation\Global.asax.cs(74): The type or namespace name 'genericPrincipal' could not be found (are you missing a using directive or an assembly reference?)

Here is my code:

using System;
using System.Collections;
using System.ComponentModel;
using System.Web;
using System.Web.SessionState;
using System.Configuration;
using System.Data.SqlClient;
using System.Data.OleDb;
using System.Data.Odbc;
using System.Data.Common;
using System.EnterpriseServices;
using System.Data;
namespace wc4
{
      /// <summary>
      /// Summary description for Global.
      /// </summary>
public class Global : System.Web.HttpApplication
{
            /// <summary>
            /// Required designer variable.
            /// </summary>
private System.ComponentModel.IContainer components = null;

public Global()
{
      InitializeComponent();
}      
            



protected void Application_AuthenticateRequest(Object sender, EventArgs e)
{
if(Request.IsAuthenticated)
{
      string connstr="server=localhost;uid=sa;pwd=;database=Tennis";
      SqlConnection conn = new SqlConnection(connstr);
      conn.Open();
      sqlCommand cmd = new SqlCommand("GetUserRoles",conn);
      cmd.CommandType=new commandType.StoredProcedure();
      cmd.Parameters.add(new SqlParamete("@Username",User.Identity.Name));
      sqlDataReader reader=cmd.ExecuteReader();

      ArrayList roleList=new ArrayList();
      while(reader.Read());
      roleList.Add(reader["Role"]);
      conn.Close();

      int i=0;
      string [] roleListArray=new string[roleList.Count];
      foreach (object ol in roleList)
      {
      roleListArray[i++]=ol.ToString();
                              
Response.Write(ol.ToString());
}
HttpContext.Current.User=new genericPrincipal(User.Identity.roleListArray);
}
}
            #region Web Form Designer generated code
            /// <summary>
            /// Required method for Designer support - do not modify
            /// the contents of this method with the code editor.
            /// </summary>
      private void InitializeComponent()
      {    
      this.components = new System.ComponentModel.Container();
      }
            #endregion
      }
}










0
Comment
Question by:sikan71
1 Comment
 
LVL 28

Accepted Solution

by:
mmarinov earned 250 total points
ID: 10975419
c# is case sensitive
so sqlCommand does not exist it is SqlCommand
sqlDataReader  is SqlDataReader
genericPrincipal is GenericPrincipal

B..M
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have developed many web applications with asp & asp.net and to add and use a dropdownlist was always a very simple task, but with the new asp.net, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.

912 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now