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

how to hadle database login failure in VB

Hi,

I am trying to connect to a database using a login.
below are the statements regarding it.
.................................................. .............
set con_to_exception_database = New ADODB.Connection
strConn = "Provider = SQLOLEDB.1;Persist Secutiry info= False; User ID= Sunny;Initial Catalog=Database;Data source = india".
conn_to_exception_datbase.Mode = adModeReadWrite.
conn_to_exception_datbase.Open strConn.
.................................................. ............................
previously the user was valid now its no more valid..I am getting an error message as below.
.................................................. .................................
Run-time error '-21474672559(80004005)'
Cannot Open database requested in login 'Database'.Login fails
.................................................. .........................................
I tried to hadle using "On Error GoTo Next_Database."
This is working when debug... but when i run its not working.
Can any one help me with this please.
Sep 22 '06 #1
1 2992
sashi
1,754 Expert 1GB
Hi there,

kidly refer to the below modified code segment, check for naming convention.. take care my fren.. :)

Expand|Select|Wrap|Line Numbers
  1. On Error Goto DBErrorHandler
  2.  
  3. set con_to_exception_database = New ADODB.Connection
  4. strConn = "Provider = SQLOLEDB.1;Persist Secutiry info= False; User ID= Sunny;Initial Catalog=Database;Data source = india".
  5. conn_to_exception_datbase.Mode = adModeReadWrite.
  6. conn_to_exception_datbase.Open strConn.
  7.  
  8. DBErrorHandler:
  9.   Msgbox "Error alert message goes here"
  10.  
Hi,

I am trying to connect to a database using a login.
below are the statements regarding it.
.................................................. .............
set con_to_exception_database = New ADODB.Connection
strConn = "Provider = SQLOLEDB.1;Persist Secutiry info= False; User ID= Sunny;Initial Catalog=Database;Data source = india".
conn_to_exception_datbase.Mode = adModeReadWrite.
conn_to_exception_datbase.Open strConn.
.................................................. ............................
previously the user was valid now its no more valid..I am getting an error message as below.
.................................................. .................................
Run-time error '-21474672559(80004005)'
Cannot Open database requested in login 'Database'.Login fails
.................................................. .........................................
I tried to hadle using "On Error GoTo Next_Database."
This is working when debug... but when i run its not working.
Can any one help me with this please.
Sep 22 '06 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: N. Graves | last post by:
Thank you for taking your time to read my question... please offer your knowledge it will be appreciated! I'm writing a ASP Web page to access a Access Database that has a Database Password set....
1
by: Twitch | last post by:
Turns out I can only use Windows Authentication for the website. So I ask again. Is there a way or method of knowing when a "Window Authentication" logon fails? Maybe a system exception I can...
1
by: Mr Gabriel | last post by:
Hi to all, I'm trying to use the copy database wizard to copy a database from the 2000 version to the 2005 version of sql server. I choose not to copy logins so I expect to find a database with...
5
by: R.A.M. | last post by:
Hello Could you help a beginner with login implementation using asp:Login (.NET 2.0). I have in Web.config: <authentication mode="Forms"> <forms name="Demo.NET" loginUrl="Default.aspx" />...
7
by: dubdave | last post by:
Hi I am trying to write a (very) basic script to compare data retrieved from a form with a mySQL database. In this case it is a simple name and password entry - if there is a corresponding entry...
2
by: TTT | last post by:
Hi, I have developed a website from the model "Starter kits Classified". Well, the application works good, no problem in my development environment. It uses a SqlServer 2005 express database...
0
by: sh | last post by:
I have a web service that logs into a database and retrieves information. Everything works fine if the login is successful. However if the login is unsuccessful, I can't get the web service to...
3
by: Michael Lang | last post by:
Hi there, I have a web application that works fine on my local dev machine. However I'm having less success on my hosting environment. When I detach the database for this site, copy it to my...
0
by: aboutjav.com | last post by:
Hi, How do I attach the .mdf and .ldf with the SQL Server Management Studio Express? Do I attached all 4 files? MyWebSiteName_log.LDF MyWebSiteName.mdf ASPNETDB.MDF aspnetdb_log.ldf
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.