Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

using directives

Posted on 2004-05-03
1
Medium Priority
?
575 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 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Integration Management Part 2
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses

926 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