Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 4.5 > ASP.NET 4.5 General Discussion
|
ASP.NET 4.5 General Discussion For ASP.NET 4.5 discussions not relating to a specific Wrox book
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 4.5 General Discussion section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 11th, 2013, 09:31 PM
Registered User
 
Join Date: Aug 2013
Posts: 15
Thanks: 1
Thanked 0 Times in 0 Posts
Default Cannot open database "UserTable" requested by the login. The login failed.

[QUOTE][QUOTE][QUOTE]Hi there.. IS there anyone can help me with this problem?

I am using Visual Studio 2008 with VB coding. I have this Login page which connect to a table called UserTable.

The odd thing is, yesterday I managed to do the login successfully. But today I tried to login, and it says cannot opened the database UserTable (where I store password & Username)

The codes is still the same.

P/S: I am not using the login control which is provided by Visual Studio.

Code:
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: Cannot open database "UserTable" requested by the login. The login failed.
Login failed for user 'AspireV5-471\Acer'.

Source Error:


Line 15: 
Line 16:         comm = New SqlCommand(UserLogin, connect)
Line 17:         connect.Open()
Line 18:         Dim check As String = comm.ExecuteScalar()
Line 19:

Last edited by jlandan2; August 11th, 2013 at 10:03 PM.. Reason: insert the error message
 
Old August 11th, 2013, 10:19 PM
Registered User
 
Join Date: Aug 2013
Posts: 15
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Well, apparently I had figured where my mistakes is.

It's actually comes from my connection string which I had copied from web.config. Something which had connection string in it.

My mistakes is accidentally add something called initial catalog which the machines cannot read. This is my wrong connection string example:

Code:
Dim connect As New SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Database.mdf;Integrated Security=True;User Instance=True; Initial Catalog=UserTable;")
So, I delete Initial Catalog=UserTable and it work fine :).. I don't know why I put Initial catalog here.

But I found my mistakes once the error keep saying it cannot open UserTable.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Error : Cannot open database "*" requested by the login.Login failed for user '*' kafshdoozak BOOK: Beginning ASP.NET 4 : in C# and VB 3 August 26th, 2012 08:43 AM
Add a CheckBox DataColumn to my DataGridView, Null format: "" or "True" but Error: F ismailc C# 2005 0 September 25th, 2009 04:56 AM
Chap 15: Cookies / "Remember Me" Login sw02 BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 3 August 12th, 2009 11:18 AM
Cannot open database "localdb_auth" requested by the login. The login failed. t00ks ASP.NET 2.0 Professional 5 March 2nd, 2009 08:43 AM
Cannot open database...The login failed RobC ASP.NET 2.0 Basics 12 October 16th, 2006 01:44 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.