Hello,
I hope this is the correct group to ask this question. I am fairly new
to programming, but have a gut feeling this is a pretty easy problem
to overcome. I hope I can explain the problem clearly enough.
Using VB.Net 2003 and MySql db.
I have a table (mySql) with the following fields:
main_category| category| sub_category| answer|date
Basically, the data will be along these lines:
Neuro | LOC | Status | answer1|date
Neuro | LOC | Status | answer2|date
Neuro | LOC | Status | answer3|date
Senso| Visi | Clarity | answer1|date
Senso| Visi | Clarity | answer2|date
etc...
I am trying to query the db and create labels in order to present the
user with the data in the following structure:
Main Category
Category
Sub Category
answer1
answer2
answer3
...
Main Category
Category
Etc...
I can create the labels ok, but I can't seem to find a way to
structure the data in the above format on the form for the user to
review.
Here's some code off the top of my head (not at the office right now,
so I will have to go by memory!):
dim myMain as new Arraylist
dim myCat as new Arraylist
dim mySub as new arraylist
dim myAns as new arraylist
dim strSql as string = "Select * from Test where date=" & strDate
myCmd = new mySqlcommand(strSql,myCon)
dim myRead as mysqldatareader = myCmd.executequery
do while myRead.read()
myMain.add(myRead("main_category"))
myCat.add(myRead("category")
....same for the other 2 fields
loop
myCon.close
dim myLabel as new label
for i = 0 to myMain.count - 1
myLabel = new label
myLabel.text = myMain(i)
myLabel.location = new system.drawing.point(x,y)
me.controls.add(myLabel)
myLabel = new label
myLabel.text = myCat(i)
myLabel.location = new system.drawing.point(x,y + 10)
me.controls.add(myLabel)
y += 20
....Then the sub categories
....then the answers...
next
Now, this is where things get a little tricky. As you can see from the
db, these arrays will be of different lengths, but I need to keep the
answers "aligned" with the Main Categories, Categories, and
Subcategories. Could someone please show me the light? Is it the way I
have structured the table, or does the answer lie elsewhere? Any help
will be greatly appreciated!
Thanks!!
Frank 1 1480
No takers??
On Thu, 01 Dec 2005 18:34:26 -0800, Frank <no****@noreply.com> wrote: Hello,
I hope this is the correct group to ask this question. I am fairly new to programming, but have a gut feeling this is a pretty easy problem to overcome. I hope I can explain the problem clearly enough. Using VB.Net 2003 and MySql db. I have a table (mySql) with the following fields:
main_category| category| sub_category| answer|date
Basically, the data will be along these lines: Neuro | LOC | Status | answer1|date Neuro | LOC | Status | answer2|date Neuro | LOC | Status | answer3|date Senso| Visi | Clarity | answer1|date Senso| Visi | Clarity | answer2|date etc... I am trying to query the db and create labels in order to present the user with the data in the following structure:
Main Category Category Sub Category answer1 answer2 answer3 ...
Main Category Category Etc...
I can create the labels ok, but I can't seem to find a way to structure the data in the above format on the form for the user to review. Here's some code off the top of my head (not at the office right now, so I will have to go by memory!):
dim myMain as new Arraylist dim myCat as new Arraylist dim mySub as new arraylist dim myAns as new arraylist
dim strSql as string = "Select * from Test where date=" & strDate myCmd = new mySqlcommand(strSql,myCon) dim myRead as mysqldatareader = myCmd.executequery do while myRead.read() myMain.add(myRead("main_category")) myCat.add(myRead("category") ...same for the other 2 fields loop myCon.close
dim myLabel as new label for i = 0 to myMain.count - 1 myLabel = new label myLabel.text = myMain(i) myLabel.location = new system.drawing.point(x,y) me.controls.add(myLabel)
myLabel = new label myLabel.text = myCat(i) myLabel.location = new system.drawing.point(x,y + 10) me.controls.add(myLabel) y += 20
...Then the sub categories ...then the answers... next
Now, this is where things get a little tricky. As you can see from the db, these arrays will be of different lengths, but I need to keep the answers "aligned" with the Main Categories, Categories, and Subcategories. Could someone please show me the light? Is it the way I have structured the table, or does the answer lie elsewhere? Any help will be greatly appreciated!
Thanks!!
Frank This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: pizzy |
last post by:
PROBLEM: I CAN'T GET THE LAST RESUTS TO WORK CORRECTLY. I WOULD
PROVIDE THE CODE (AND WILL IF REQUESTED).
BUT IN MY OWN WORDS I AM TRYING TO HAVE THE FIRST FORM
DYNAMICALLY CREATE INPUT BOXES...
|
by: hzgt9b |
last post by:
Is it possible to dynamically add controls (speciifcally
System.Windows.Forms.ProgressBar and System.Windows.Forms.Label) to a panel
to a form and have them display (and fucntion) at run time?
...
|
by: Nathan Bloomfield |
last post by:
Does anyone know if there is any documentation which relates to Access2k + ?
or can anyone help adjust the code?
I am having trouble converting the DAO references.
TITLE :INF: How to...
|
by: Brad |
last post by:
Thanks for taking the time to read my question.
I have a table of data that has Date, Data and Category. I need to
show, in
a report, each Categories Data by Date. The Date has to be it's own...
|
by: Mike Collins |
last post by:
I have a web form that has most of the UI designed. On this form, some of the
labels, textboxes, dropdowns, etc. will be added dynamically, depending on
what extra bits of data the user decides...
|
by: nsvmani |
last post by:
Hi, i am trying to get the FileOpen dialogue window as soon as clicked href link
I am using IE6 with ActiveX enabled. Just need to get the File Open dialogue window when i click on the HREF links.It...
|
by: markryan57 |
last post by:
Greetings,
I searched for this, but cannot find exaclty what I am looking for. I am trying to dynamically create labels on a form just before it opens. I am reading from a database, building the...
|
by: anniejacob |
last post by:
hi,
I am making a dynamic form which i have to put some labels which r 2 b dynamic.n i have to make 'n' number of labels dynamically.
label me = new label();
This is the line im using to...
|
by: dazzler |
last post by:
I have application which creates data table from loaded data, table cells are created using labels.
I am trying to do following: when the mouse cursor is over the one label it will be highlighted...
|
by: bharathi228 |
last post by:
my code for retrieving values from database
Dim da As New SqlDataAdapter("select parameter_name,parameter_units from sys_params", con)
If con.State = ConnectionState.Closed Then
con.Open()...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
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...
|
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
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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...
|
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,...
|
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...
| |