Solved

using directives

Posted on 2004-05-03
1
539 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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…
In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

820 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