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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I stop Empty Row returning?

Status
Not open for further replies.

culshaja

Programmer
Aug 10, 1999
705
GB
I am using ADO 2.1 and the Jet OLE DB provider. I a issuing a select on a table which uses an autonumber as the key. When I get a result which has no matching records I get an empty row returned. If I issue the same SQL in access I get an empty row with '(autonumber)' in the key column. How do I get rid of this empty row in the ADO recordset? <p>James Culshaw<br><a href=mailto:james_culshaw@activedatasolutions.madasafish.com>james_culshaw@activedatasolutions.madasafish.com</a><br><a href= > </a><br>
 
Hi James,<br>
<br>
Are you trying to populate somekind of datagrid with the ADO recordset? Thats the only reason I could imagine you getting a row back with the autonumber, its not an actual row. Its just the way that the recordset is being displayed. <br>
<br>
If you are using a datagrid, don't bring back the autonumber column.<br>
<br>
Cal.
 
I'm not using a datagrid. Heres and example of my code:<br>
<br>
strSelectSQL = &quot;SELECT * FROM x WHERE y;&quot;<br>
Set rstAssignment = New ADODB.Recordset<br>
rstAssignment.Open strSelectSQL, acnWS, adOpenStatic, _ <br>
adLockReadOnly<br>
<br>
I then get back a row with a recordcount of 1. When you use watch, you see that all the columns are returned empty.<br>
<br>
James :) <p>James Culshaw<br><a href=mailto:james_culshaw@activedatasolutions.madasafish.com>james_culshaw@activedatasolutions.madasafish.com</a><br><a href= > </a><br>
 
Where is the empty row at?<br>
In Vb DataGrid or in Access when you view the table.<br>
And is it in fact saving that empty and you want to get rid of it or what?<br>
The nature of an Autonumber is it should not increment until data is entered in another field and you either leave that field or save it.<br>
Obviously you can't enter any thing in the autonumber field.<br>
<br>
<br>
<p> DougP<br><a href=mailto: dposton@universal1.com> dposton@universal1.com</a><br><a href= > </a><br>
 
The empty row is in the actual ADODB recordset variable. I am testing to see if some data has been enetered previously so that if it has I can do some processing. The recordset is NOT bound to anything.<br>
<br>
James :) <p>James Culshaw<br><a href=mailto:james_culshaw@activedatasolutions.madasafish.com>james_culshaw@activedatasolutions.madasafish.com</a><br><a href= > </a><br>
 
So are you getting a &quot;Recordcount&quot; on the recordset and its giving you an extra record?<br>
<p> DougP<br><a href=mailto: dposton@universal1.com> dposton@universal1.com</a><br><a href= > </a><br>
 
Yep, thats about teh sum total of it and its driving me insane at this point as its probably something simple taht I've missed.<br>
<br>
James :) <p>James Culshaw<br><a href=mailto:james_culshaw@activedatasolutions.madasafish.com>james_culshaw@activedatasolutions.madasafish.com</a><br><a href= > </a><br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top