recordset object problems

Results 1 to 5 of 5

Thread: recordset object problems

  1. #1
    Join Date
    Dec 1969
    Posts
    35

    Default recordset object problems

    Alright, I know that using Javascript is a bit against the grain these days when writing ASP pages, but well that&#039s what I use. Now given that information I&#039m tring to pull about five columns from an Access DB, but for some reason I seem only to be able to get 1 record out of 1431. I&#039ve set up the connection in the following way:<BR><BR>var conn=Server.CreateObject("ADODB.Connection");<BR>D SNstr="HRdata";<BR>conn.Open(DSNstr, "administrator", "password");<BR>var record=Server.CreateObject("ADODB.Recordset");<BR> SQLstr="SELECT division, jobtitle, emplno, lastname, firstname FROM master"<BR>record.Open(SQLstr, conn);<BR><BR>I&#039m assuming that&#039s all correct, but when I do a record.RecordCount the number that&#039s returned is -1 which usually means that the property isn&#039t supported. Possible in an Access database, but mabey not. Any thoughts out there?

  2. #2
    Join Date
    Dec 1969
    Posts
    2,849

    Default RE: recordset object problems

    You&#039re code for opening the recordset is correct, but you&#039re using the wrong type of recordset cursor. Only certain recordset cursors can use the RecordCount property.<BR><BR>By default, the cursor type is ForwardOnly, which doesn&#039t allow for the RecordCount Property. I won&#039t go into too much detail, there is an article at 4Guys. If you still have questions on it, ask here! :)<BR><BR>http://4guysfromrolla.com/webtech/112998-1.shtml<BR><BR>Happy Programming!

  3. #3
    Join Date
    Dec 1969
    Posts
    35

    Default RE: recordset object problems

    Okay so I agree that the query is correct what I&#039m having problems with is writing this loop in Javascript:<BR>&#060;select name="results"><BR> &#060;%do while not objRecordset.EOF&#037;&#062;<BR> &#060;option value="&#060;%=objRecordset("emplno")&#037;&#062;" >&#060;%=objRecordset("lastname")&#037;&#062;<BR > &#060;%objRecordset.MoveNext<BR> loop&#037;&#062;<BR>&#060;/select><BR>the problem comes from what appears to be Javascript&#039s inability to execute a MoveNext combined with my inability to write the "do while not objRecordset.EOF" line in JavaScript. Any suggestion here?

  4. #4
    Join Date
    Dec 1969
    Posts
    35

    Default RE: recordset object problems

    Never Mind I figured it out.


  5. #5
    Join Date
    Dec 1969
    Posts
    2,849

    Default RE: recordset object problems

    For those who didn&#039t figure it out, let me clue them in.. :)<BR><BR>To do a movenext in JavaScript:<BR><BR>objRS.MoveNext();<BR><BR>Happy programming!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •