473,322 Members | 1,846 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.

oConn.Errors.Count problem with DSN-Less connection

I had an old application that uses ASP/ADO BVScript (Classic) to connect to a SQL Server via ODBC. Due to the fact that the present server (Win 2008 R2, IIS 7.0) will be retired soon, I am forced to move the application to a new server (also 2008 R2.) The new server does not support ODBC connections, only DSN-Less connection is permitted.
I move the application to the new location without a problem and connect well to the database with the DSN-Less connection. But now the following section of code does not want to work. It always returns a no error code (0), even after an error. Other words, I cannot trap the error:

<%
Set oConn = Server.CreateObject("ADODB.Connection")

vDSN = "Provider=SQLOLEDB;User ID=userID;password=password;Initial Catalog=SQLdb;Data Source=Server"
oConn.ConnectionString = vDSN
oConn.Open

'---Check for password--------------------------------
Set objCmd = Server.CreateObject("ADODB.Command")
Set objCmd.ActiveConnection = oConn

objCmd.CommandText = "{CALL dbo.prVP ('" & CStr(AB) &_
"','" & CStr(P) & "')}"

objCmd.CommandType = adCmdText
objCmd.Execute

Response.Write oConn.Errors.Count
Response.End

If oConn.Errors.Count > 0 Then
Set ObjErr = Server.CreateObject("ADODB.Error")

For Each ObjErr in oConn.Errors
If ObjErr.Number <> 0 Then
'Response.Write "<b>Number: </b>" & ObjErr.Number & "<br>"
'Response.Write "<b>Description: </b>" & ObjErr.Description & "<br>"
'Response.Write "<b>Source: </b>" & ObjErr.Source & "<br>"
'Response.Write "<b>SQLState: </b>" & ObjErr.SQLState & "<br>"
'Response.Write "<b>NativeError: </b>" & ObjErr.NativeError & "<br>"
'Response.Write "<b>ErrHandler: </b>" & "ERROR." & "<br>"
blnCriticalError = True
End If
Next

Set ObjErr = Nothing

If blnCriticalError Then
oConn.Errors.Clear
%> <form method="GET" action="http://bytes.com/AuthoSerReqForm.asp"> <p align="left"><b><font size="3" face="MS Sans Serif" color="#FF0000">Invalid password.</font></b> <input type="submit" value="Try Again" name="B1"></p> <input type="hidden" name="SRID" value="<%=srid%>"> <input type="hidden" name="C" value="<%=c%>"> <input type="hidden" name="AB" value="<%=ab%>"> </form> <%
objCmd.Close
Set objCmd = Nothing

oConn.Close
Set oConn = Nothing

Response.End
End If
End If
%>

Did anybody encounter this problem out there before?
Thank for the help.
Jul 29 '14 #1
0 1030

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

Similar topics

2
by: Colin Steadman | last post by:
What is the best way to control is a transaction? I've done a little test and both of the examples below seem to do the job, but I was wondering which is the better method, this: If err.number <>...
11
by: David | last post by:
I am writing SQL data apps using VB.NET 2003, MSDE is being used as the server. When I create and instance of the server, it has a the format machinename/instancename This is fine for the...
2
by: Alex | last post by:
Hi all, I'm running into a road block, and I know I've done this before. I'm getting fields from two tables, and I need to do a count of similar items with it showing some extra info. Here's...
2
by: Tony Epton | last post by:
<crossposted to several groups> Is there any way to create a DSNless connection to SQL server from access 97 (DAO) All the samples of connection strings I am finding - all have a reference to a...
4
by: Maziar Aflatoun | last post by:
Hi everyone, I am working on the 'Delete' section of my program. What I need to do is query my database and for every ID that it finds I want to remove a file+ID.jpg from my file folder and...
1
by: James Goodman | last post by:
In VB6 I used to set my applications to automatically look for the source DB in the program installation directory. If it wasnt found it was fairly easy to pop a dialog asking the user to specify the...
4
by: MrsBean | last post by:
I've been working on learning how to use PHP with MS Access, and as long as I use ODBC, I can make it work. I want to use a DSNless connection. Everthing I have tried has failed. Can anyone show...
20
by: fniles | last post by:
I am using VB.NET 2003, SQL 2000, and SqlDataReader. As I read data from tblA, I want to populate tblB. I use SQLDataReader for both tables. I do not use thread. When I ExecuteReader on tblB, I...
8
Dököll
by: Dököll | last post by:
Hiya Fans! I hit a brick wall. I was attempting to make a DSNLess connection I seemed to have Goofed somewhere: Private Sub SQLServer_Click() Dim MyWorkspace As DAO.Workspace Set...
1
by: DivyangK | last post by:
I want to make connection with one connection object and two connecion strings.While I dont want to break first connection that is made with first connection string.
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...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
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: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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.