[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now


Cannot open database "ASPNETDB" requested by the login. The login failed. Login failed for user 'B47\Kola'.

Posted on 2008-06-25
Medium Priority
Last Modified: 2013-11-26
Please i cant seem to find out what i and doing wrong, i am getting the error "Cannot open database "ASPNETDB" requested by the login. The login failed. Login failed for user 'B47\Kola'."

i am using a stored procedure to add data from form to SQL SERVER 2005, i have attached below the snippets stored procedure, Addevent.aspx.cs, and web config respectively

Please can some help


ALTER PROCEDURE dbo.StoredProcedure1 
	@parameter1 int = 5,
	@parameter2 datatype OUTPUT
	@EventId varchar(50),
	@UserId varchar(50),
	@CatId varchar(50),
	@EventName varchar(50),
	@Organiser varchar(50),
	@ContactEmail varchar(50),
	@ShortText varchar(50),
	@LongText varchar(50),
	@Address varchar(50),
	@City char(30),
	@Price Money,
	@Thumbnail varchar(20),
	@eImage varchar(20),
	@eDate datetime,
	@eTime varchar(10),
	@Venue varchar(50),
	@Tickets varchar(50),
	@Age char(10)
(EventId, UserId, CatId, EventName, Organiser, ContactEmail, ShortText, LongText, Address, City, Price, Thumbnail, eImage, eDate, eTime, Venue, Tickets, Age)
	VALUES(@EventId, @UserId, @CatId, @EventName, @Organiser, @ContactEmail, @ShortText, @LongText, @Address, @City, @Price, @Thumbnail, @eImage, @eDate, @eTime, @Venue, @Tickets, @Age)
public partial class AddEvent : System.Web.UI.Page
    protected void Page_Load(object sender, EventArgs e)
           if (!IsPostBack)
               MembershipUser myObject = Membership.GetUser();
               string UserID = myObject.ProviderUserKey.ToString();
               Label6.Text = UserID;
    protected void Button1_Click(object sender, EventArgs e)
        SqlCommand cmd = new SqlCommand("StoredProcedure1 ", new SqlConnection(ConfigurationManager.AppSettings["ConnString"]));
        cmd.CommandType = CommandType.StoredProcedure;
        /*cmd.Parameters.AddWithValue("@UserID", UserID);*/
        cmd.Parameters.AddWithValue("@EventName", eName.Text);
        cmd.Parameters.AddWithValue("@city", Organiser.Text);
        cmd.Parameters.AddWithValue("@ContactEmail", ContactEmail.Text);
        cmd.Parameters.AddWithValue("ShortText", Short.Text);
        cmd.Parameters.AddWithValue("@LongText", Long.Text);
        cmd.Parameters.AddWithValue("@Address", Address.Text);
        cmd.Parameters.AddWithValue("@City", City.Text);
        cmd.Parameters.AddWithValue("@Price", Price.Text);
        cmd.Parameters.AddWithValue("@eDate", Date.Text);
        cmd.Parameters.AddWithValue("@eTime", Time.Text);
        cmd.Parameters.AddWithValue("@Venue", Venue.Text);
        cmd.Parameters.AddWithValue("@Tickets", Tickets.Text);
        /*cmd.Parameters.AddWithValue("@Age", Age.SelectedIndex.ToString);*/
        /*cmd.Parameters.AddWithValue("@name", txtName.Text);
        cmd.Parameters.AddWithValue("@city", txtCity.Text);
        cmd.Parameters.AddWithValue("@name", txtName.Text);
        cmd.Parameters.AddWithValue("@city", txtCity.Text);*/
		<add name ="ASPNETDBConnectionString1" connectionString ="Data Source= .\SQLEXPRESS; Integrated Security = True;  Initial Catalog= ASPNETDB"  providerName ="System.Data.SqlClient"/>		
				<network host="localhost"/>
    <validation validateIntegratedModeConfiguration="false"/>
      <add name="ScriptModule" preCondition="integratedMode" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
      <remove name="WebServiceHandlerFactory-Integrated" />
      <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode"
           type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
      <add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode"
           type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
      <add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
		<add key="ConnString" value="Data Source=.\SQLEXPRESS;Initial Catalog=ASPNETDB;Integrated Security=True"/>

Open in new window

Question by:kladtek
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
LVL 21

Accepted Solution

naspinski earned 1500 total points
ID: 21864700
look in your SQL Server Management Studio.

Under Security->Logins, make sure that that user is there and has sufficient rights.

Author Comment

ID: 21865175
thanks for your reply

having a look at the logins as u mentioned her is what i found


i guess the user is not there

what do i do next

thanks again
LVL 21

Expert Comment

ID: 21865207
you can add the user by right clicking 'Logins' and select 'New Login' now browse for the user and give them proper permissions in the 'server roles' tab.

Author Comment

ID: 21865620
hello thanks again

i successfully did that,

however, when i ran the script again it still gave me the same error message
LVL 21

Expert Comment

ID: 21871227
Is this on the same machine?
Do you have remote connections enabled?

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

649 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