Solved

using directives

Posted on 2004-05-03
1
526 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
Comment Utility
c# is case sensitive
so sqlCommand does not exist it is SqlCommand
sqlDataReader  is SqlDataReader
genericPrincipal is GenericPrincipal

B..M
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Run time error with script.render loc 2 26
javascript call 6 35
can not add ASP.NET to IIS 8 26
Problem to page 4 16
In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

772 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

10 Experts available now in Live!

Get 1:1 Help Now