473,750 Members | 2,308 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Login failed for user 'admin'.

I am a beginner and trying my first C# application.
Any reason why I am getting the message Login failed for user 'admin'
I have thoroughly checked the security settings in the sql server.

Find my code below.

using System;
using System.Collecti ons;
using System.Componen tModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.Sess ionState;
using System.Web.UI;
using System.Web.UI.W ebControls;
using System.Web.UI.H tmlControls;

namespace WebApplication3
{
/// <summary>
/// Summary description for DataForm1.
/// </summary>
public class DataForm1 : System.Web.UI.P age
{
protected WebApplication3 .ds objds;
protected System.Web.UI.W ebControls.Butt on buttonLoad;
protected System.Data.Sql Client.SqlDataA dapter sqlDataAdapter1 ;
public System.Data.Sql Client.SqlConne ction myConnection;
protected System.Data.Sql Client.SqlComma nd sqlSelectComman d1;
protected System.Data.Sql Client.SqlComma nd sqlInsertComman d1;
protected System.Data.Sql Client.SqlComma nd sqlUpdateComman d1;
protected System.Data.Sql Client.SqlComma nd sqlDeleteComman d1;
protected System.Web.UI.W ebControls.Data Grid myList;

private void Page_Load(objec t sender, System.EventArg s e)
{
// Put user code to initialize the page here
System.Data.Sql Client.SqlConne ction myConnection = new System.Data.Sql Client.SqlConne ction();
System.Data.Sql Client.SqlDataA dapter sqlDataAdapter1 = new System.Data.Sql Client.SqlDataA dapter();
}

#region Web Form Designer generated code
override protected void OnInit(EventArg s e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeCompo nent();
base.OnInit(e);
}

/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeCompo nent()
{
System.Configur ation.AppSettin gsReader configurationAp pSettings = new System.Configur ation.AppSettin gsReader();
this.objds = new WebApplication3 .ds();
this.sqlDataAda pter1 = new System.Data.Sql Client.SqlDataA dapter();
this.sqlDeleteC ommand1 = new System.Data.Sql Client.SqlComma nd();
this.myConnecti on = new System.Data.Sql Client.SqlConne ction();
this.sqlInsertC ommand1 = new System.Data.Sql Client.SqlComma nd();
this.sqlSelectC ommand1 = new System.Data.Sql Client.SqlComma nd();
this.sqlUpdateC ommand1 = new System.Data.Sql Client.SqlComma nd();
((System.Compon entModel.ISuppo rtInitialize)(t his.objds)).Beg inInit();
this.buttonLoad .Click += new System.EventHan dler(this.butto nLoad_Click);
this.myList.Sel ectedIndexChang ed += new System.EventHan dler(this.maste rDataGrid_Selec tedIndexChanged );
//
// objds
//
this.objds.Data SetName = "ds";
this.objds.Loca le = new System.Globaliz ation.CultureIn fo("en-US");
this.objds.Name space = "http://www.tempuri.org/ds.xsd";
//
// sqlDataAdapter1
//
this.sqlDataAda pter1.DeleteCom mand = this.sqlDeleteC ommand1;
this.sqlDataAda pter1.InsertCom mand = this.sqlInsertC ommand1;
this.sqlDataAda pter1.SelectCom mand = this.sqlSelectC ommand1;
this.sqlDataAda pter1.TableMapp ings.AddRange(n ew System.Data.Com mon.DataTableMa pping[] {
new System.Data.Com mon.DataTableMa pping("Table", "Course", new System.Data.Com mon.DataColumnM apping[] {
new System.Data.Com mon.DataColumnM apping("CourseI D", "CourseID") ,
new System.Data.Com mon.DataColumnM apping("CourseN ame", "CourseName "),
new System.Data.Com mon.DataColumnM apping("CourseD escription", "CourseDescript ion"),
new System.Data.Com mon.DataColumnM apping("Activat e", "Activate")})}) ;
this.sqlDataAda pter1.UpdateCom mand = this.sqlUpdateC ommand1;
//
// sqlDeleteComman d1
//
this.sqlDeleteC ommand1.Command Text = @"DELETE FROM Course WHERE (CourseID = @Original_Cours eID) AND (Activate = @Original_Activ ate OR @Original_Activ ate IS NULL AND Activate IS NULL) AND (CourseDescript ion = @Original_Cours eDescription OR @Original_Cours eDescription IS NULL AND CourseDescripti on IS NULL) AND (CourseName = @Original_Cours eName)";
this.sqlDeleteC ommand1.Connect ion = this.myConnecti on;
this.sqlDeleteC ommand1.Paramet ers.Add(new System.Data.Sql Client.SqlParam eter("@Original _CourseID", System.Data.Sql DbType.Decimal, 9, System.Data.Par ameterDirection .Input, false, ((System.Byte)( 18)), ((System.Byte)( 0)), "CourseID", System.Data.Dat aRowVersion.Ori ginal, null));
this.sqlDeleteC ommand1.Paramet ers.Add(new System.Data.Sql Client.SqlParam eter("@Original _Activate", System.Data.Sql DbType.Bit, 1, System.Data.Par ameterDirection .Input, false, ((System.Byte)( 0)), ((System.Byte)( 0)), "Activate", System.Data.Dat aRowVersion.Ori ginal, null));
this.sqlDeleteC ommand1.Paramet ers.Add(new System.Data.Sql Client.SqlParam eter("@Original _CourseDescript ion", System.Data.Sql DbType.VarChar, 255, System.Data.Par ameterDirection .Input, false, ((System.Byte)( 0)), ((System.Byte)( 0)), "CourseDescript ion", System.Data.Dat aRowVersion.Ori ginal, null));
this.sqlDeleteC ommand1.Paramet ers.Add(new System.Data.Sql Client.SqlParam eter("@Original _CourseName", System.Data.Sql DbType.VarChar, 50, System.Data.Par ameterDirection .Input, false, ((System.Byte)( 0)), ((System.Byte)( 0)), "CourseName ", System.Data.Dat aRowVersion.Ori ginal, null));
//
// myConnection
//
this.myConnecti on.ConnectionSt ring = ((string)(confi gurationAppSett ings.GetValue(" myConnection.Co nnectionString" , typeof(string)) ));
//
// sqlInsertComman d1
//
this.sqlInsertC ommand1.Command Text = "INSERT INTO Course(CourseNa me, CourseDescripti on, Activate) VALUES (@CourseName, " +
"@CourseDescrip tion, @Activate); SELECT CourseID, CourseName, CourseDescripti on, " +
"Activate FROM Course WHERE (CourseID = @@IDENTITY)";
this.sqlInsertC ommand1.Connect ion = this.myConnecti on;
this.sqlInsertC ommand1.Paramet ers.Add(new System.Data.Sql Client.SqlParam eter("@CourseNa me", System.Data.Sql DbType.VarChar, 50, "CourseName "));
this.sqlInsertC ommand1.Paramet ers.Add(new System.Data.Sql Client.SqlParam eter("@CourseDe scription", System.Data.Sql DbType.VarChar, 255, "CourseDescript ion"));
this.sqlInsertC ommand1.Paramet ers.Add(new System.Data.Sql Client.SqlParam eter("@Activate ", System.Data.Sql DbType.Bit, 1, "Activate") );
//
// sqlSelectComman d1
//
this.sqlSelectC ommand1.Command Text = "SELECT CourseID, CourseName, CourseDescripti on, Activate FROM Course";
this.sqlSelectC ommand1.Connect ion = this.myConnecti on;
//
// sqlUpdateComman d1
//
this.sqlUpdateC ommand1.Command Text = @"UPDATE Course SET CourseName = @CourseName, CourseDescripti on = @CourseDescript ion, Activate = @Activate WHERE (CourseID = @Original_Cours eID) AND (Activate = @Original_Activ ate OR @Original_Activ ate IS NULL AND Activate IS NULL) AND (CourseDescript ion = @Original_Cours eDescription OR @Original_Cours eDescription IS NULL AND CourseDescripti on IS NULL) AND (CourseName = @Original_Cours eName); SELECT CourseID, CourseName, CourseDescripti on, Activate FROM Course WHERE (CourseID = @CourseID)";
this.sqlUpdateC ommand1.Connect ion = this.myConnecti on;
this.sqlUpdateC ommand1.Paramet ers.Add(new System.Data.Sql Client.SqlParam eter("@CourseNa me", System.Data.Sql DbType.VarChar, 50, "CourseName "));
this.sqlUpdateC ommand1.Paramet ers.Add(new System.Data.Sql Client.SqlParam eter("@CourseDe scription", System.Data.Sql DbType.VarChar, 255, "CourseDescript ion"));
this.sqlUpdateC ommand1.Paramet ers.Add(new System.Data.Sql Client.SqlParam eter("@Activate ", System.Data.Sql DbType.Bit, 1, "Activate") );
this.sqlUpdateC ommand1.Paramet ers.Add(new System.Data.Sql Client.SqlParam eter("@Original _CourseID", System.Data.Sql DbType.Decimal, 9, System.Data.Par ameterDirection .Input, false, ((System.Byte)( 18)), ((System.Byte)( 0)), "CourseID", System.Data.Dat aRowVersion.Ori ginal, null));
this.sqlUpdateC ommand1.Paramet ers.Add(new System.Data.Sql Client.SqlParam eter("@Original _Activate", System.Data.Sql DbType.Bit, 1, System.Data.Par ameterDirection .Input, false, ((System.Byte)( 0)), ((System.Byte)( 0)), "Activate", System.Data.Dat aRowVersion.Ori ginal, null));
this.sqlUpdateC ommand1.Paramet ers.Add(new System.Data.Sql Client.SqlParam eter("@Original _CourseDescript ion", System.Data.Sql DbType.VarChar, 255, System.Data.Par ameterDirection .Input, false, ((System.Byte)( 0)), ((System.Byte)( 0)), "CourseDescript ion", System.Data.Dat aRowVersion.Ori ginal, null));
this.sqlUpdateC ommand1.Paramet ers.Add(new System.Data.Sql Client.SqlParam eter("@Original _CourseName", System.Data.Sql DbType.VarChar, 50, System.Data.Par ameterDirection .Input, false, ((System.Byte)( 0)), ((System.Byte)( 0)), "CourseName ", System.Data.Dat aRowVersion.Ori ginal, null));
this.sqlUpdateC ommand1.Paramet ers.Add(new System.Data.Sql Client.SqlParam eter("@CourseID ", System.Data.Sql DbType.Decimal, 9, System.Data.Par ameterDirection .Input, false, ((System.Byte)( 18)), ((System.Byte)( 0)), "CourseID", System.Data.Dat aRowVersion.Cur rent, null));
this.Load += new System.EventHan dler(this.Page_ Load);
((System.Compon entModel.ISuppo rtInitialize)(t his.objds)).End Init();

}
#endregion

private void buttonLoad_Clic k(object sender, System.EventArg s e)
{
try
{
// Place code here to fill the dataset. The grid will not render in the page if the dataset is empty.

DataSet ds = new DataSet();
sqlDataAdapter1 .Fill(ds, "Course");

myList.DataSour ce = ds.Tables["Course"].DefaultView;
myList.DataBind ();

this.myList.Sel ectedIndex = -1;
this.myList.Dat aBind();
}
catch (System.Excepti on eLoad)
{
this.Response.W rite(eLoad.Mess age);
}

}

private void masterDataGrid_ SelectedIndexCh anged(object sender, System.EventArg s e)
{

}
}
}
---
Posted using Wimdows.net NntpNews Component -

Post Made from http://www.DotNetJunkies.com/newsgroups Our newsgroup engine supports Post Alerts, Ratings, and Searching.
Jul 21 '05 #1
0 1574

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
2866
by: TheDD | last post by:
Hello every body, i have to do a news system wich use php/mysql. i need 3 accounts: * a 'reader' who doesn't need to log in to read the news * a 'writer' who can write news in a pending news table * a 'moderator' which validate a pending news, and make it a regular news, viewable from the site (by the 'reader')
0
955
by: Calvin I | last post by:
Hi All, I am having a problem getting access to a SQL server on windows 2003. My web server is running on a windows 2003 platform. I continually get the Login failed for user null. Not associated...blah blah message each time. There is no ASPNET user on the SQL server because I have removed IIS. I cannot access the \\webserver\aspnet user from the enterprise admin to grant them access to the database. I have disabled anonymous...
1
1619
by: Homa | last post by:
Hi, I am using a role-based Forms Authentication. I have several directories that have different levels of authorization. When I try to access another directory, the page bounce me back to the login page everytime. After I re-login, I can access the page. I can't figure out what happened. I saved the roles to the User so when I access another page, they should able to see that before they bounce me out.
0
1210
by: jamesa | last post by:
I am a beginner and trying my first C# application. Any reason why I am getting the message Login failed for user 'admin' I have thoroughly checked the security settings in the sql server. Find my code below. using System; using System.Collections; using System.ComponentModel; using System.Data;
9
2570
by: dana lees | last post by:
Hello, I am developing a C# asp.net application. I am using the authentication and authorization mechanism, which its timeout is set to 60 minutes. My application consists of 2 frames - a header frame and a main frame. When i enter the application, i see the login screen on the whole screen, but when the authentication expires, the login screen appears on both frames.
2
4563
by: Ronald | last post by:
I just started with dotnetnuke, and with a wrong login (wrong password on a clean install i can crash the application pool from IIS. (when i login with the right username/password information the site works fine, i can do anything it is supposed to do) I have the following setup: -Windows 2003 x64 (fully patched, clean install) -Dotnetframework 2.0.50727 -Dotnetnuke 4.3.1
1
4994
by: Jakob Lithner | last post by:
When I started a new ASP project I was eager to use the login facilities offered in Framework 2.0/VS 2005. I wanted: - A custom principal that could hold my integer UserID from the database - An easy way to classify different pages as either Admin, Member or Public, where login is necessary for Admin and Member but not for Public. My idea was to put the pages in different directories to easily keep my order. - An easy menu system that...
9
3593
by: Ben | last post by:
Hello, I'll bet this has been asked a million times but I can't seem to find a thread that gives the clear example I need. This PC has MySQL and IIS configured and running. The MySQL database is "myDB" with a table "myUsers" with fields "Username" and "Password". I also have the MySQL ODBC driver loaded with a DSN "dsnMySQL" setup. First question is can someone direct me to a site or provide a sample code for a login page that...
1
2626
by: jsd219 | last post by:
I have a fairly simple login in script and I need to make it have two levels of access not one. can anyone help me with this? The script is below: <?php // we must never forget to start the session session_start(); $errorMessage = ''; if (isset($_POST) && isset($_POST)) { include 'config.php';
0
8997
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8833
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9389
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9256
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8257
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6079
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4709
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4881
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2794
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.