VBA
Discuss AutoCAD ActiveX and VBA (Visual Basic for Applications) questions here.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Reply
Message 1 of 5
Anonymous
130 Views, 4 Replies

RecordSets

Hi there all,

I'm using dynamic recordsets, created at runtime of my project.

Does anybody know if I can perform SQL-statemants on them, and how...I don't use a Connection for the recordsets

I can process the recordset and do some simple sorting and so..but if I could use SQL statements it would be a lot easier.


sample of the construction of the recordsets:
Private Selection_Records As ADODB.Recordset
Set Selection_Records = New ADODB.Recordset

With Selection_Records.Fields
.Append "IdIndex", adInteger

etc....and then AddNew values...

Thanks for any help.
4 REPLIES 4
Message 2 of 5
Anonymous
in reply to: Anonymous

I have not been able to find a way to send SQL to a dataset.
You can use the Filter method but that isn't as robust as SQL.

I sure hope someone responds with a better answer than that.

wrote in message news:5364761@discussion.autodesk.com...
Hi there all,

I'm using dynamic recordsets, created at runtime of my project.

Does anybody know if I can perform SQL-statemants on them, and how...I don't
use a Connection for the recordsets

I can process the recordset and do some simple sorting and so..but if I
could use SQL statements it would be a lot easier.


sample of the construction of the recordsets:
Private Selection_Records As ADODB.Recordset
Set Selection_Records = New ADODB.Recordset

With Selection_Records.Fields
.Append "IdIndex", adInteger

etc....and then AddNew values...

Thanks for any help.
Message 3 of 5
Anonymous
in reply to: Anonymous

as Mark Johnston said...

check out
.Sort
.Filter = sSql


I tried using recordset that way but my selection criteria was too
complicated to handle with a simple filter
but maybe it will work for you
I ended up putting the records in a .mdb file and used conn.Execute (sSql)
for more complicated Select Where Order By etc statements
it was just as easy to write a db on the fly as it was to write the
recorset - creating fields/types etc and much more flexible
hth
Mark


wrote in message news:5364761@discussion.autodesk.com...
Hi there all,

I'm using dynamic recordsets, created at runtime of my project.

Does anybody know if I can perform SQL-statemants on them, and how...I don't
use a Connection for the recordsets

I can process the recordset and do some simple sorting and so..but if I
could use SQL statements it would be a lot easier.


sample of the construction of the recordsets:
Private Selection_Records As ADODB.Recordset
Set Selection_Records = New ADODB.Recordset

With Selection_Records.Fields
.Append "IdIndex", adInteger

etc....and then AddNew values...

Thanks for any help.
Message 4 of 5
Anonymous
in reply to: Anonymous

Thanks for the replies,

I already use the Filter option.
But I need for example all unique values of a specific field,
now I use
1. the Filter option to limit the recordset to a specific criteria
2. sort the specific field
3. retrieve all unique values to a Array.

Maybe I'll use a dummy mdb file to save data to by copying the empty dummy to the user temp-dir with each AutoCAD Session with unique filename 00001.mdb or so.....if needed.

MP, how do you cope with the fact that another acad-session could use the table in the database.....or is you're data static...

Mike
Message 5 of 5
Anonymous
in reply to: Anonymous

wrote in message news:5364921@discussion.autodesk.com...
Thanks for the replies,

I already use the Filter option.
But I need for example all unique values of a specific field,
now I use
1. the Filter option to limit the recordset to a specific criteria
2. sort the specific field
3. retrieve all unique values to a Array.

Maybe I'll use a dummy mdb file to save data to by copying the empty dummy
to the user temp-dir with each AutoCAD Session with unique filename
00001.mdb or so.....if needed.

MP, how do you cope with the fact that another acad-session could use the
table in the database.....or is you're data static...

right, my data is static
my prog is only one that knows about db, writes it/reads it/ not multi user
so very simple ... lots of issues i don't need to deal with i guess
:-)
Lucky for me!!!

Mark

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Forma Design Contest


Autodesk Design & Make Report