DB access outside form

huhhuhhuh

Active member
Joined
Feb 28, 2006
Messages
42
Programming Experience
Beginner
I've been creating and managing database connections in forms using drag and drop items to this point.

What I want to know is what do I need to achieve this outside a form, say a class. For instance in my class, I import the dataset from the main form. Then I assign these imported datasets to 'invisible' listboxes, and specify the display members. I've had no problems obtaining a value using FindStringExact, but apparently any attempt to access the listboxes via methods such as SetIndex result in null reference exception, almost as if the items aren't being filled into the listboxes.

What then do I need to remedy this or at least manually set up a db connection? Do I need an oledbconnection object? A dataadapter? New datasets? If so, how do I go about doing this?
 
bump.

How can I create database connection to an Access database via code? No server explorer, no click and drop, no toolbox, justmplain code.
 
bump

Please, this is urgent. I've tried writing one by myself, didn't work, suspect some necessary items/components may be missing. Looked around, found a lot of examples, in other languages. Found even more examples, all tell me how easy it is to drag and drop from toolbox, specify/configure dataadapter etc. Found some awesome videos, showing how to drag and drop from toolbox etc.

I just want to write a clean connection from within a class. Please help
 
So you want to programatically create a connection string, without any user interaction? Well thats hard, very hard, infact i would say pretty much impossible. There is a way to use com to open the datalink window in an application.. you know, like the one that pops up when you configure the dataadapter? is this anything like what you are looking for?
 
Back
Top