0
votes

I have written the following code:

strConnection ="Provider=SQLOLEDB;Server=PC-101\SQLEXPRESSR2;Database=LDS;Integrated Security=true"

Set rs = Server.CreateObject("ADODB.Recordset")

select_SQL = "select * from tblMonthlySales order by store_id"

On Error Resume Next

rs.open(strConnection , select_SQL)

If Err.Number <> 0 Then
   response.Write(Err)
On Error Goto 0 ' But don't let other errors hide!
' Code to cope with the error here
End If
On Error Goto 0 ' Reset error handling.

I am using SQL Server 2008 for my database.

And I am not able to catch the error and getting this message

An error occurred on the server when processing the URL. Please contact the system administrator. If you are the system administrator please click here to find out more about this error.

Is my connecting string wrong?

I had also tried this connection string:

strConnection ="Provider=SQLNCLI10;Server=PC-101\SQLEXPRESSR2;Database=LDS;Integrated Security=SSPI;DataTypeCompatibility=80;"

Any help is appreciated

1
It is probably your use of Integrated Security. The user trying to access the database is the account your ASP is running under - not the account that is calling it. You might get a better idea of the error by turning friendly error messages off in your browser. - James Culshaw
@JamesCulshaw How can i turn it off. - Moons
@JamesCulshaw You are correct Connection string is buggy - Moons
From an IE side you needs to go to Tools->Internet Options->Advanced and then uncheck show friendly error messages. As @Caner G notes below if you are using IIS7 and above you will need to cnahe some settings in IIS. - James Culshaw

1 Answers

1
votes

Can you please enable your configuration to get error details? This might work to do that : asp errors not displayed