473,396 Members | 1,945 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

compiler error c# CS0103: The name 'CommandType' does not exist in the current conte

Expand|Select|Wrap|Line Numbers
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Web.UI;
  6. using System.Web.UI.WebControls;
  7. using System.Data.SqlClient;
  8. using System.Web.Security;
  9. using System.Data;
  10.  
  11. public partial class Login : System.Web.UI.Page
  12. {
  13.     protected void Page_Load(object sender, EventArgs e)
  14.     {
  15.  
  16.     }
  17.     protected void Button1_Click(object sender, EventArgs e)
  18.     {
  19.  
  20.         SqlConnection Cn = new SqlConnection("server=nikhil;database=mydb;uid=sa;pwd=123");
  21.         SqlCommand Cmd = new SqlCommand();
  22.         Cmd.Connection = Cn;
  23.         Cmd.CommandText = "validateuser";
  24.         Cn.Open();
  25.         Cmd.CommandType =CommandType.StoredProcedure;
  26.         Cmd.Parameters.Clear();
  27.         Cmd.Parameters.AddWithValue("", TextBox1.Text);
  28.         Cmd.Parameters.AddWithValue("", TextBox2.Text);
  29.         SqlDataReader Dr = Cmd.ExecuteReader();
  30.         if (Dr.Read())
  31.             FormsAuthentication.RedirectFromLoginPage(TextBox1.Text, false);
  32.         else
  33.             Label1.Text = "user id/password is wrong";
  34.  
  35.         Dr.Close();
  36.         Cn.Close();
  37.     }
  38. }
Feb 20 '13 #1
0 1294

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: vengala s reddy | last post by:
Dim test as new MyTime.Login() Line 16: Dim ds as new DataSet Line 17: ERROR LINE=ds = test.CheckSubmitFlags("7", "2","2004") Line 18: 'dr.read() Line 19: I AM TRYING TO RETURN A DATA SET FROM...
3
by: maya | last post by:
am following "asp.NET Unleashed", by Stephen Walther (a SAMS book.. covers .net 1.1 though..) on one of his examples (ch 2) am getting compilation error.. code: <script Runat="Server"> void...
1
by: Arjen | last post by:
Hi, I do this inside a repeater: <% if ((Boolean)((DataRowView)Container.DataItem) == true) { %> <%} %> I get this message: CS0103: The name 'Container' does not exist in the current...
3
by: Michael | last post by:
Hi, I am getting a strange error. Last night when I left work this was working perfectly. This morning when I try to run this code in VS2005, it comes up with an error saying "The name 'UserName'...
3
by: gdubois | last post by:
Hi!! I am trying for the first time to put on our intranet a really basic ASP.NET page, using VS2003 and C#. It's a page reading some info from an ACCESS database, using one dataset...
4
by: techguy78 | last post by:
Hi - I added a gridview to me aspx page and i 'm trying to assing data to it from codebehind. i'm getting this error.. The name 'Gridview1' does not exist in the current context Any idea...
2
by: weird0 | last post by:
When i am working on client side of a webservice, where i add a reference to it(have written the function CheckPincode inside the webservice), the compiler says: the name CheckPincode does not...
5
by: nudrat | last post by:
I included a control TextBox with 'txtError' name. whenever I build this I get this error. The name 'txtError' does not exist in the current context But its running on last successful Build. I...
0
by: Terry | last post by:
Hello, I have problem adding controls to my webpage default.aspx. There is a group of controls that just refuse to be used with message: 'The name 'controlname' does not exist in the current...
0
by: vaibhavbhosale | last post by:
I am using master page. It contains textbox with other controls on it. I can catch textbox name in code behind page but while compiling it gives error like textbox not exists in current context....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.