473,382 Members | 1,368 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,382 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.
Nov 22 '05 #1
0 1203

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: 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...
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...
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...
12
by: tvnaidu | last post by:
I have Two kinds of web pagess, one is for control page for only admin login, another one is to view status for user login. initially both html files can view with 192.168.0.10/control.htm and other...
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: 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...

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.