Re: visual studio 2005 dataset questions

  • From: "Richard Thomas" <rthomas@xxxxxxxxxxx>
  • To: <programmingblind@xxxxxxxxxxxxx>
  • Date: Thu, 10 Jan 2008 06:00:17 -0500

Hi Jared:
Sure. As you are likely learning Microsoft and related documentation is rather messy to use. I'll give you a quick overview of the general technique but you will need to post your specific code requirement to get anything detailed. So, you have a DataBase with Tables and Rows. You generated your DataSet, the xsd file, from the IDE by creating a DataSource or some other way.
In your program yould would create a class, perhaps MyClass.
In the class you would instantiate the DataTable defined in your DataSet. MyTable
You would instantiate the DataRow defined in the DataSet, MyRow.
You would instantiate the TableAdapter defined in the DataSet, MyAdapter.
Then you are ready to go.
If you had defined a method called GetData() when you created the TableAdapter for your DataSet you might do something like the following:
Dim intDataSet As MyDataSet = New MyDataset()
Dim intTable as MyDataSet.MyTable = New MyDataSet.MyTable)
Dim intRow as MyDataSet.MyRow = New MyDataSet.MyRow()
' fill the table:
Dim intAdapter As New MyAdapter()
intTable = intAdapter.GetData()
iterate the rows in the table.
For Each intRow in intTable
MessageBox.Show( "A colum value is " & intRow.ColumnName)
Next intRow
I'm not at all sure about the syntax, off the top of my head and the particular combination of DataSet, table and row names will depend on your particular DataSet code. But that is only one of many ways you can work with a DataSet's objects without using binding. Put up a specific code question and I might be able to narrow down an answer some. What are you trying to do? Do you want to use a DataTable for the underlying source for a ListBox? Something with a DataGridView? Just some DataBase work without any or much UI? It is all quite diferent when working with disconnected DataSets although the underlying methods are the same or similar.
Rick Farmington Mich. USA

----- Original Message ----- From: "Jared Stofflett" <stofflet@xxxxxxx>
To: <programmingblind@xxxxxxxxxxxxx>; <program-l@xxxxxxxxxxxxx>
Sent: Thursday, January 10, 2008 3:18 PM
Subject: visual studio 2005 dataset questions


Everything I've seen so far about the dataset designer uses a dataset to bind controls on a form to the dataset. Is there a way to use a generated dataset to execute queries and insert records strictly through code with out binding to controls? If so could someone please point me to examples of this?
__________
View the list's information and change your settings at //www.freelists.org/list/programmingblind


__________
View the list's information and change your settings at //www.freelists.org/list/programmingblind

Other related posts: