Home All Groups Group Topic Archive Search About

Quesion about ADO.NET in VB.NET

Author
11 Aug 2006 10:24 AM
Cylix
I have a number of function to get some data in database,
What is the better design for the task?

There should be three function to get differnece data in difference
tables,
They may need to be call seperately, and so I prefer they have their
own function.

However, In my program, The startup process must run this function once
to set up the UI.
So I prefer there may be another function to get all the there
recordset to a datatable.
And finally, combine and return a dataset.

Actually, the bottle neck is on connection, and so, I would like to use
as few as possible of connection.

Thank you.

Author
11 Aug 2006 10:42 AM
Cor Ligthert [MVP]
Cylix,

Which VB version are you using because for this the answers for version
2002/3 and 2005 can be different?

However keep in mind that with Adonet the best method is to open and close
connections as often as that is possible. (And because it is disconnected
instead of the connected ADO is that possible).

I hope this helps sofar.

Cor

Show quoteHide quote
"Cylix" <cylix2***@gmail.com> schreef in bericht
news:1155291884.453616.151620@m73g2000cwd.googlegroups.com...
>I have a number of function to get some data in database,
> What is the better design for the task?
>
> There should be three function to get differnece data in difference
> tables,
> They may need to be call seperately, and so I prefer they have their
> own function.
>
> However, In my program, The startup process must run this function once
> to set up the UI.
> So I prefer there may be another function to get all the there
> recordset to a datatable.
> And finally, combine and return a dataset.
>
> Actually, the bottle neck is on connection, and so, I would like to use
> as few as possible of connection.
>
> Thank you.
>
Author
14 Aug 2006 1:05 AM
Cylix
> Which VB version are you using because for this the answers for version
> 2002/3 and 2005 can be different?
I am using VS2003.

> However keep in mind that with Adonet the best method is to open and close
> connections as often as that is possible. (And because it is disconnected
> instead of the connected ADO is that possible).
But the bottle neck is on database connection, so i would like to take
three tables once in the startup connection and close it then.
Author
14 Aug 2006 6:09 AM
Cor Ligthert [MVP]
Cylix,

With version VS2003 you can add a Component to your project. That will open
a layer on which you can drag 3 times a dataadapter and than use every time
the same dataset.

That component becomes your DataLayer Class

To optimize slightly the normal behaviour you can than use that as
Connect.open
da1.Fill(ds)
da2.fill(ds)
da3.fill(ds)
conn.close

Be aware always to close the connection corresponding the open.
These newsgroups are filled in past by people who did not and got connection
problems.

I hope this helps,

Cor

Show quoteHide quote
"Cylix" <cylix2***@gmail.com> schreef in bericht
news:1155517501.193293.292950@m73g2000cwd.googlegroups.com...
>> Which VB version are you using because for this the answers for version
>> 2002/3 and 2005 can be different?
> I am using VS2003.
>
>> However keep in mind that with Adonet the best method is to open and
>> close
>> connections as often as that is possible. (And because it is disconnected
>> instead of the connected ADO is that possible).
> But the bottle neck is on database connection, so i would like to take
> three tables once in the startup connection and close it then.
>