Re: [2005] Database question
First, I would do a search on thsi forum. I am sure there are plenty of examples. Second, I would look at some of the signatures of the responders. Many of those have links to coding examples.
Re: [2005] Database question
There's many a couple of ways to do it but here's one:
Code:
Dim cmdSelect as New OleDbCommand
Dim daSelect as New OleDbDataAdapter
Dim dsSelect as New Dataset
cmdSelect = "YOUR SQL STATEMENT"
daInset.SelectCommand = cmdSelect
cmdSelect.Connection = "YOUR CONNECTION HERE"
daSelect.Fill (YOUR DATASET)
Re: [2005] Database question
Re: [2005] Database question
Hey, thanx for the replies. I have one more question though...what do i put for my connection string, because surely if i've added to database to my project, isn't it already connected??? Or am i just talkin complete rubbish (which would be the shock of the century! :-P lol)
Thanks again.
:afrog:
Re: [2005] Database question
When you added the database to your project the system created a typed DataSet for you. The XSD file is the XML schema description of that DataSet. Along with the DataSet it also created TableAdapters. All the connection and SQL information is encapsulated within them. As you add tables and columns to your database you should regenerate your DataSet using the Configure button in the Data Sources window. That will re-run the wizard allow you to change the schema of your DataSet to match the database.
Once that's done you simply create an instance of your DataSet and the appropriate TableAdapter, then call the Fill method of the TableAdapter to populate the corresponding DataTable in the DataSet.
You can create the objects by dragging them from the Toolbox window onto your form or else you can create them in code, just like any other objects. You can also create them and corresponding bound controls by dragging tables and columns from the Data Sources window onto your form.
I suggest that you start reading here.