J
Joe Soap
Hello all.
I am starting to get the hang of this all now (VB 2008 from VB6). I must
admit, I like it, but the learnig curve is steep.
A couple of questions:
1. I return a datatable to load up my combobox.
In VB6, I would check that the recordset pointer is at the top..ie the
recordset pointer is not, for some reason, pointing at a record halfway down
the recordset..can happen. So I would use something like this:
....................
.........
If rsgeneric.RecordCount > 0 Then
rsgeneric.MoveLast
rsgeneric.MoveFirst <'*I can also get an
accurate recordset count at the same time
..........
Do I have to do the same with a datatable, or is the returned dataset
pointer always positioned at row 0? If not, what is the syntax please?
At the moment I am stuck with:
If m_DataTable.Rows.Count > 0 Then
m_DataTable.(???).(???)
and I want the dataset pointer to be positioned at the first record ,
as with my old recordset.
2. The second question is not related to this, but it is something that I
have wanted to do for a long time, and I am quite excited about the
possiblities:
In VB6, if I get a recordset that I want to manipulate further, ie, get a
subset of the recordset, I have to dump the recordset into a temp table and
then work on that, writing back my computations or whatever to another
recordset for insertion into another db table if I want to keep the results.
With a datatable, can I further manipulate the data without dumping to a
temp table? For example..I have a recordset of all people who used a
particular toothpaste. At a later stage..in a function, I may want to refer
to that particular recordset and get a sub group of those who..for
example..are married. I could write another querty, but as my data is
already contained in the recordset, why should I? In VB6, the only way to
get a sub-group of the recordset is to dump the recordset into a temp table,
and then re-query it for my sub group. So, can I get a sub group directly
from a datatable?
Thank you for your time and any help that you can off.
Best regards
David
I am starting to get the hang of this all now (VB 2008 from VB6). I must
admit, I like it, but the learnig curve is steep.
A couple of questions:
1. I return a datatable to load up my combobox.
In VB6, I would check that the recordset pointer is at the top..ie the
recordset pointer is not, for some reason, pointing at a record halfway down
the recordset..can happen. So I would use something like this:
....................
.........
If rsgeneric.RecordCount > 0 Then
rsgeneric.MoveLast
rsgeneric.MoveFirst <'*I can also get an
accurate recordset count at the same time
..........
Do I have to do the same with a datatable, or is the returned dataset
pointer always positioned at row 0? If not, what is the syntax please?
At the moment I am stuck with:
If m_DataTable.Rows.Count > 0 Then
m_DataTable.(???).(???)
and I want the dataset pointer to be positioned at the first record ,
as with my old recordset.
2. The second question is not related to this, but it is something that I
have wanted to do for a long time, and I am quite excited about the
possiblities:
In VB6, if I get a recordset that I want to manipulate further, ie, get a
subset of the recordset, I have to dump the recordset into a temp table and
then work on that, writing back my computations or whatever to another
recordset for insertion into another db table if I want to keep the results.
With a datatable, can I further manipulate the data without dumping to a
temp table? For example..I have a recordset of all people who used a
particular toothpaste. At a later stage..in a function, I may want to refer
to that particular recordset and get a sub group of those who..for
example..are married. I could write another querty, but as my data is
already contained in the recordset, why should I? In VB6, the only way to
get a sub-group of the recordset is to dump the recordset into a temp table,
and then re-query it for my sub group. So, can I get a sub group directly
from a datatable?
Thank you for your time and any help that you can off.
Best regards
David