Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

using directives

Posted on 2004-05-03
1
Medium Priority
?
568 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 28

Accepted Solution

by:
mmarinov earned 1000 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

721 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