×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

How do I stop Empty Row returning?

How do I stop Empty Row returning?

How do I stop Empty Row returning?

(OP)
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?

James Culshaw
james_culshaw@activedatasolutions.madasafish.com

RE: How do I stop Empty Row returning?

Hi James,

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.

If you are using a datagrid, don't bring back the autonumber column.

Cal.

RE: How do I stop Empty Row returning?

(OP)
I'm not using a datagrid. Heres and example of my code:

strSelectSQL = "SELECT * FROM x WHERE y;"
Set rstAssignment = New ADODB.Recordset
rstAssignment.Open strSelectSQL, acnWS, adOpenStatic, _
adLockReadOnly

I then get back a row with a recordcount of 1. When you use watch, you see that all the columns are returned empty.

James :-)

James Culshaw
james_culshaw@activedatasolutions.madasafish.com

RE: How do I stop Empty Row returning?

Where is the empty row at?
In Vb DataGrid or in Access when you view the table.
And is it in fact saving that empty and you want to get rid of it or what?
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.
Obviously you can't enter any thing in the autonumber field.


DougP
dposton@universal1.com

RE: How do I stop Empty Row returning?

(OP)
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.

James :-)

James Culshaw
james_culshaw@activedatasolutions.madasafish.com

RE: How do I stop Empty Row returning?

So are you getting a "Recordcount" on the recordset and its giving you an extra record?

DougP
dposton@universal1.com

RE: How do I stop Empty Row returning?

(OP)
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.

James :-)

James Culshaw
james_culshaw@activedatasolutions.madasafish.com

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close