473,322 Members | 1,188 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,322 software developers and data experts.

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.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;

namespace WebApplication3
{
/// <summary>
/// Summary description for DataForm1.
/// </summary>
public class DataForm1 : System.Web.UI.Page
{
protected WebApplication3.ds objds;
protected System.Web.UI.WebControls.Button buttonLoad;
protected System.Data.SqlClient.SqlDataAdapter sqlDataAdapter1;
public System.Data.SqlClient.SqlConnection myConnection;
protected System.Data.SqlClient.SqlCommand sqlSelectCommand1;
protected System.Data.SqlClient.SqlCommand sqlInsertCommand1;
protected System.Data.SqlClient.SqlCommand sqlUpdateCommand1;
protected System.Data.SqlClient.SqlCommand sqlDeleteCommand1;
protected System.Web.UI.WebControls.DataGrid myList;

private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
System.Data.SqlClient.SqlConnection myConnection = new System.Data.SqlClient.SqlConnection();
System.Data.SqlClient.SqlDataAdapter sqlDataAdapter1 = new System.Data.SqlClient.SqlDataAdapter();
}

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

/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.Configuration.AppSettingsReader configurationAppSettings = new System.Configuration.AppSettingsReader();
this.objds = new WebApplication3.ds();
this.sqlDataAdapter1 = new System.Data.SqlClient.SqlDataAdapter();
this.sqlDeleteCommand1 = new System.Data.SqlClient.SqlCommand();
this.myConnection = new System.Data.SqlClient.SqlConnection();
this.sqlInsertCommand1 = new System.Data.SqlClient.SqlCommand();
this.sqlSelectCommand1 = new System.Data.SqlClient.SqlCommand();
this.sqlUpdateCommand1 = new System.Data.SqlClient.SqlCommand();
((System.ComponentModel.ISupportInitialize)(this.o bjds)).BeginInit();
this.buttonLoad.Click += new System.EventHandler(this.buttonLoad_Click);
this.myList.SelectedIndexChanged += new System.EventHandler(this.masterDataGrid_SelectedIn dexChanged);
//
// objds
//
this.objds.DataSetName = "ds";
this.objds.Locale = new System.Globalization.CultureInfo("en-US");
this.objds.Namespace = "http://www.tempuri.org/ds.xsd";
//
// sqlDataAdapter1
//
this.sqlDataAdapter1.DeleteCommand = this.sqlDeleteCommand1;
this.sqlDataAdapter1.InsertCommand = this.sqlInsertCommand1;
this.sqlDataAdapter1.SelectCommand = this.sqlSelectCommand1;
this.sqlDataAdapter1.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] {
new System.Data.Common.DataTableMapping("Table", "Course", new System.Data.Common.DataColumnMapping[] {
new System.Data.Common.DataColumnMapping("CourseID", "CourseID"),
new System.Data.Common.DataColumnMapping("CourseName", "CourseName"),
new System.Data.Common.DataColumnMapping("CourseDescri ption", "CourseDescription"),
new System.Data.Common.DataColumnMapping("Activate", "Activate")})});
this.sqlDataAdapter1.UpdateCommand = this.sqlUpdateCommand1;
//
// sqlDeleteCommand1
//
this.sqlDeleteCommand1.CommandText = @"DELETE FROM Course WHERE (CourseID = @Original_CourseID) AND (Activate = @Original_Activate OR @Original_Activate IS NULL AND Activate IS NULL) AND (CourseDescription = @Original_CourseDescription OR @Original_CourseDescription IS NULL AND CourseDescription IS NULL) AND (CourseName = @Original_CourseName)";
this.sqlDeleteCommand1.Connection = this.myConnection;
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_Cour seID", System.Data.SqlDbType.Decimal, 9, System.Data.ParameterDirection.Input, false, ((System.Byte)(18)), ((System.Byte)(0)), "CourseID", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_Acti vate", System.Data.SqlDbType.Bit, 1, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "Activate", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_Cour seDescription", System.Data.SqlDbType.VarChar, 255, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "CourseDescription", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_Cour seName", System.Data.SqlDbType.VarChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "CourseName", System.Data.DataRowVersion.Original, null));
//
// myConnection
//
this.myConnection.ConnectionString = ((string)(configurationAppSettings.GetValue("myCon nection.ConnectionString", typeof(string))));
//
// sqlInsertCommand1
//
this.sqlInsertCommand1.CommandText = "INSERT INTO Course(CourseName, CourseDescription, Activate) VALUES (@CourseName, " +
"@CourseDescription, @Activate); SELECT CourseID, CourseName, CourseDescription, " +
"Activate FROM Course WHERE (CourseID = @@IDENTITY)";
this.sqlInsertCommand1.Connection = this.myConnection;
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@CourseName", System.Data.SqlDbType.VarChar, 50, "CourseName"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@CourseDescrip tion", System.Data.SqlDbType.VarChar, 255, "CourseDescription"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Activate", System.Data.SqlDbType.Bit, 1, "Activate"));
//
// sqlSelectCommand1
//
this.sqlSelectCommand1.CommandText = "SELECT CourseID, CourseName, CourseDescription, Activate FROM Course";
this.sqlSelectCommand1.Connection = this.myConnection;
//
// sqlUpdateCommand1
//
this.sqlUpdateCommand1.CommandText = @"UPDATE Course SET CourseName = @CourseName, CourseDescription = @CourseDescription, Activate = @Activate WHERE (CourseID = @Original_CourseID) AND (Activate = @Original_Activate OR @Original_Activate IS NULL AND Activate IS NULL) AND (CourseDescription = @Original_CourseDescription OR @Original_CourseDescription IS NULL AND CourseDescription IS NULL) AND (CourseName = @Original_CourseName); SELECT CourseID, CourseName, CourseDescription, Activate FROM Course WHERE (CourseID = @CourseID)";
this.sqlUpdateCommand1.Connection = this.myConnection;
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@CourseName", System.Data.SqlDbType.VarChar, 50, "CourseName"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@CourseDescrip tion", System.Data.SqlDbType.VarChar, 255, "CourseDescription"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Activate", System.Data.SqlDbType.Bit, 1, "Activate"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_Cour seID", System.Data.SqlDbType.Decimal, 9, System.Data.ParameterDirection.Input, false, ((System.Byte)(18)), ((System.Byte)(0)), "CourseID", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_Acti vate", System.Data.SqlDbType.Bit, 1, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "Activate", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_Cour seDescription", System.Data.SqlDbType.VarChar, 255, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "CourseDescription", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_Cour seName", System.Data.SqlDbType.VarChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "CourseName", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@CourseID", System.Data.SqlDbType.Decimal, 9, System.Data.ParameterDirection.Input, false, ((System.Byte)(18)), ((System.Byte)(0)), "CourseID", System.Data.DataRowVersion.Current, null));
this.Load += new System.EventHandler(this.Page_Load);
((System.ComponentModel.ISupportInitialize)(this.o bjds)).EndInit();

}
#endregion

private void buttonLoad_Click(object sender, System.EventArgs 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.DataSource = ds.Tables["Course"].DefaultView;
myList.DataBind();

this.myList.SelectedIndex = -1;
this.myList.DataBind();
}
catch (System.Exception eLoad)
{
this.Response.Write(eLoad.Message);
}

}

private void masterDataGrid_SelectedIndexChanged(object sender, System.EventArgs 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 1561

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

Similar topics

10
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...
0
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...
1
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...
0
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...
9
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...
2
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...
1
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 -...
9
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...
1
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.