vb.net MDI multiple db connections?

  • Thread starter Thread starter SandChicken
  • Start date Start date
S

SandChicken

I have multiple forms that get shown when the users clicks
on a button. Each child form has data on it the is
recieved from the same database but from different tables.

My problem is that I can't get this to work without adding
a new db connection on each form. I've tried jsut adding
a dataset on the new form but it automatically creates a
new db connection for it.

It doesn't seem very elegant to have multiple connection
to the same DB in one project. I'm new at programming so
I was hoping for a simple solution.

Thank you
 
Just do it programmatically. Don't do it drag and drop.
See details at my post of "General Functions for Using
ADO.NET"

Bin Song, MCP
 
In the main form, just fill the one Dataset there with all the desired tables however you need to change its deceleration to:

Public Shared WithEvents DataSet11 As Form1.DataSet1

Note that you need to use the "Shared" keyword.

Now in the child forms you should be able to use that dataset as:

Form1.DataSet11.MyTable

I hope this helps!


Thanks,
Hussein Abuthuraya
Microsoft Developer Support

This posting is provided "AS IS" with no warranties, and confers no rights.

Are you secure? For information about the Microsoft Strategic Technology Protection Program and to order your FREE Security Tool Kit, please visit
http://www.microsoft.com/security.
 
Back
Top