Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Recordcount = -1 , Why?

Status
Not open for further replies.

Aamin

Programmer
Oct 2, 2002
18
0
0
CA
...After I open the connection, I have the following code:
Set RS = Server.CreateObject("ADODB.Recordset")
strq = "SELECT * FROM Customer Where CustLicenseNum = '" & custlnum & "'"
set RS = conn.Execute(strq)

if (RS.RecordCount < 1) then
'"There were no records found. Please try your query again."
response.redirect "searchcust.asp"
else
msg = "1 record found."
end if

It finds the record but the Recordcount is -1. Shouldn't the Recordcount = 1 if a record is found?

Please advise, thx.
 
search the forum for the question. many, many O' many threads with the answer



___________________________________________________________________
[sub]
onpnt.com
SELECT * FROM programmers WHERE clue > 0
(0 row(s) affected) -->faq333-3811
[/sub]

 
thread333-868738 -- just in case that search leaves you empty

___________________________________________________________________
[sub]
onpnt.com
SELECT * FROM programmers WHERE clue > 0
(0 row(s) affected) -->faq333-3811
[/sub]

 
I got it to work this way:

set cmd4 = CreateObject("ADODB.Command")
set rs = server.createobject("adodb.recordset" )
cmd4.ActiveConnection = conn
cmd4.CommandText = "SELECT * FROM Customer Where
CustLicenseNum = '" & custlnum & "'"
rs.open cmd4,,1,3

I have another prb also...I need to attach pictures to a form and send the form with the pictures to a DB as Objects...

ONPNT, do you have MSN where we can chat about it?
 
Hi Aamin,

Take a look at this...
Code:
    Set connupdate = Server.CreateObject( "ADODB.Connection" )
    Set rec = server.CreateObject("ADODB.Recordset")
    'Create connection to the table, and use OLEDB.4.0 driver
    connupdate.Open "Data Source=" & Server.Mappath("scouts.mdb") & ";Provider=Microsoft.Jet.OLEDB.4.0;"
    dim objRS
    set objRS = server.CreateObject("ADODB.Recordset")
[COLOR=red]
   ' Required or ERROR will occur
   ' Set the cursor location to client side (3)
    objRS.CursorLocation = 3
[/color]
    objRs.open "Select * from tblBannedIP where RecordID = 0", connupdate, 3, 3
    objRS.AddNew
    objRS.Fields("IP") = strRemoteIP
    objRS.Update
    objrs.Close
set objrs = Nothing
connupdate.Close
[/code/

AccessGuruCarl
  Programmers helping programmers
  you can't find a better site.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top