English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

<%

Set objConn = Server.CreateObject( "ADODB.Connection" )
objConn.Open "DSN=****;Uid=****;Pwd=****"
Set objRS = Server.CreateObject( "ADODB.Recordset" )
objRS.Open "SELECT * FROM passports WHERE sspnumber = 2075" objConn, 3, 1
If objRS.RecordCount > 0 Then
response.write "works"
Else
response.write "notthere"
End If

Set objRS = Nothing
objConn.Close
Set objConn = Nothing
%>

Can you tell me what could be causing this in my coding?

2007-01-05 12:47:23 · 4 answers · asked by Anonymous in Computers & Internet Programming & Design

4 answers

Break the code into parts.

Start with

Set objConn = Server.CreateObject( "ADODB.Connection" )
objConn.Open "DSN=****;Uid=****;Pwd=****"

If that works, add in

objRS.Open "SELECT * FROM passports WHERE sspnumber = 2075" objConn, 3, 1

If that works, add in

If objRS.RecordCount > 0 Then
response.write "works"
Else
response.write "notthere"
End If

If that works, add in

Set objRS = Nothing

If that works, add in

objConn.Close
Set objConn = Nothing

It will fail at one of those points. Report back which of those points it fails.

2007-01-05 14:49:20 · answer #1 · answered by Anonymous · 0 0

Try this

<%
Set objConn = Server.CreateObject( "ADODB.Connection" )
objConn.Open "DSN=****;Uid=****;Pwd=****"
Set objRS = objConn.Execute("SELECT * FROM passports WHERE sspnumber = 2075")
If Not objRS.EOF Then
Response.write "works"
Else
Response.write "notthere"
End If

objRS.Close
Set objRS = Nothing
objConn.Close
Set objConn = Nothing
%>


It could also be that your DSN isn't set up correctly...

However, without telling me the exact error, there's no way of being sure exactly what the problem is. If you don't see the full error, you're probably using Internet Explorer (try using a better browser like Firefox). If you must use Internet Explorer; turn off the "friendly error messages" option. If you have full logging enabled in IIS, you should be able to find the full error in your web server log files.

2007-01-05 21:09:36 · answer #2 · answered by Timmy T 3 · 0 0

You forgot to put a comma before "objConn, 3, 1"

Your statement should be :
objRS.Open "SELECT * FROM passports WHERE sspnumber = 2075", objConn, 3, 1

2007-01-09 03:14:23 · answer #3 · answered by silverpet 6 · 0 0

Some of the common website errors you encounter when you are surfing the internet.
More details with the solution is available at http://errors.in/website.html

2007-01-09 09:56:18 · answer #4 · answered by asila 3 · 0 0

fedest.com, questions and answers