473,385 Members | 1,588 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

DataGrid / DataSet Issue

Hi all,

I'm having a little trouble with some code Im writing and Im thinking
there has to be an easy fix. What Ive done is fill a dataset via 3
odbcdataadapters. The dataset is also the datasourse for a datagrid.
When I run the program, the datagrid is nothing more than an empty box
with a graybox in the top left corner. If I explode the graybox, I
have the choice of choosing the odbcdataadapter, and once I select an
adapter and click it, the grid fills with all the correct info. This
all works the way it is meant to.

Heres the problem. I've created a combobox that automatically fills
with all the available odbcdataadapters. The idea is to let the end
user choose here instead of having to explode the graybox.

If I code DataGrid3.DataSource = DataSet11.SO_03SOHistoryHeader

For example, it works like a champ and fills the grid.
However, I need something like:
Dim mySelection as string = combobox1.selectedtext.tostring
'(say user selected "SO_03SOHistoryHeader" - same as above)

DataGrid3.DataSource = DataSet11.mySelection
"ERROR - mySelection is not a member of DataSet11"

This obviously does not work. I cant figure out how to implement a
variable into the statement.

Ive also tried:

With DataSet3
.DataSource = DataSet11
.DataMember = mySelection

End with

This also does not work, however is runs without reporting an error
Any help will be greatly appreciated.
Thanks,

Josh

Nov 21 '05 #1
4 1194
Josh,

Two things, don't use ODBC however when it is Oracle. Oracleclient. When it
is SQL SQLClient, and all others OleDB if possible (and that is mostly).

Have for your problem a look at the dataview. Be aware that that is not a
seperate table however a view on it. As it is included in every datatable as
datatable.defaultview.

http://msdn.microsoft.com/library/de...iltertopic.asp

I point you directly on the rowfilter because that is what you need when you
solve your solution using this to see the class just click on that in top of
the page by overview.

(There are of course much more methods)

I hope this helps,

Cor
Nov 21 '05 #2
Cor,

Thanks for the input. The database I'm using is actually MAS90 by
Best. I'm writing a little application to grab data as needed (read
only) from different tables and bring it together in one datagrid where
it can then be further manipulated by the user. The problem is that I
have no way of knowing which tables are needed - this is all done at
runtime - and I don't want to fill all tables because there is a
tremendous amount of tables and data. So what I've done is created a
listbox that is filled with all the table names when the form loads
with the idea that the user can choose the tables they need. To fill a
datagrid for example, I would then us something like:

dim exampleTable as string
exampleTable = listbox1.SelectedItem 'user selects table from list

DataGrid1.DataSource = DataSet11.exampleTable
In theory it works for me, but I cant seem to convince VB.Net to go
along with it.

Thanks again and I'll research the dataview.

Josh

Nov 21 '05 #3
Youngster,

Probably has this nothing to do with the dataview, however not difficult to
achieve/

Create a datatable with the text and the name of the tables.

From that you make just a simple connection string.

"Select * from " & valuemember.listbox

Do a dataset fill
Bind that to your dataset.
And you are almost ready.
Be aware that this is a very primitive way of use.

If you want more information reply.

Than maybe I try to make a little sample.
However not any more tonight,

Cor

<yo*********@hotmail.com> schreef in bericht
news:11**********************@g44g2000cwa.googlegr oups.com...
Cor,

Thanks for the input. The database I'm using is actually MAS90 by
Best. I'm writing a little application to grab data as needed (read
only) from different tables and bring it together in one datagrid where
it can then be further manipulated by the user. The problem is that I
have no way of knowing which tables are needed - this is all done at
runtime - and I don't want to fill all tables because there is a
tremendous amount of tables and data. So what I've done is created a
listbox that is filled with all the table names when the form loads
with the idea that the user can choose the tables they need. To fill a
datagrid for example, I would then us something like:

dim exampleTable as string
exampleTable = listbox1.SelectedItem 'user selects table from list

DataGrid1.DataSource = DataSet11.exampleTable
In theory it works for me, but I cant seem to convince VB.Net to go
along with it.

Thanks again and I'll research the dataview.

Josh

Nov 21 '05 #4
Thanks Cor.
The connection string is where I went wrong. Believe it or not, I used
Microsoft Excel to connect to the database where I chose the tables I
needed and then ran a query to get the data I wanted- after which I
saved the query and then viewed the connection string it automatically
created to connect to the database. It turns out I was leaving out a
relevant table. I also got a list from a MAS90 rep of all the tables,
how they are linked, and what tables you need to include to run a
query. This helped tremendously because I came to find that tables
appearing to be master tables, were not master tables at all. For
example in this case I was using the SalesOrderEntry table and the
SO_UDF table. Well it turns out that there is a SalesOrderEntryDetail
table which is the master table linking these two tables together. I
could have never figured this out on my own.

Thanks for you time and help one this one.

Nov 21 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Junkguy | last post by:
I need some help programmatically causing a row in a DataGrid to "flush" its contents to its bound data (in Visual Studio 6 using Windows Forms with C#). My issue is I want to send an update to...
3
by: Diego TERCERO | last post by:
Hi... I'm working on a tool for editing text resources for a family of software product my company produces. These text resources are found in a SQL Server database, in a table called...
9
by: Pam Ammond | last post by:
After clicking btnDeleteSize_Click in frmSize, I move to frmSizeDelete, allow deleting a Size using a datagrid, and then return to frmSize and want to update the datagrid in frmSize to reflect the...
4
by: Steve B. | last post by:
I have a DataGrid on the left and TextBoxes (TB) on the right. The TB's reflect the contents of the grid cells. Sorting of columns (both thru VS and programmatically) work fine except, when the...
24
by: Mike L | last post by:
This is for a Win form, in C# 2005. I want to load a datagrid, make some columns width 0, and then clean out the record I added. I get the error message, ""Index was out of range. Must be...
2
by: Dimitris Pantazopoulos | last post by:
Hello. I am trying to do the simplest of things. These are exactly the steps I follow: 1. create an sqlConnection to an SQL Server database. 2. create a DataSource and produce a DataSet to a...
3
by: Danky | last post by:
Hello Masters! Anyone can help me with the datagrid, well, the app load a lot of data from DB and it show on the datagrid, and well, I need to allow paging and.... the issue is with the event...
2
by: Steve Pierce | last post by:
I am having some issues with a runtime dropdownlist in a datagrid. The issue is that I cannot get ViewState to fill the selected index of a runtime dropdown properly on postback. I do not want to...
0
by: Bob Davies | last post by:
Hi I have a webservice that retrieves data from a database, this is then returned to the calling client application built in windows forms within a dataset, however upon attempting to create...
0
by: theintrepidfox | last post by:
Dear Group I really need your help on this issue. I've a datagrid which source is a dataview based on a dataset. The columns of the grid are datagridtextbox columns created like the following...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.