Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Ho do I put data from a database table into a matrix?

Status
Not open for further replies.
May 22, 2002
6
0
0
NO
Hello,

I am quiet new to this, but I am learning it step by step and by my self. This forum is a great benefit for me in this situation too.

Up to now I have used datagrids to this type of problems but now I want to try using a matrix to help me, and to do so I will need a little help from someone (hopefully I get what I need from this forum).

I want to store some data from an SQL-server into a matrix by using this SQL-sentence:

strSQL = "SELECT ProdNo, ProdName, AltProdNo FROM Dekl_MovexProduct WHERE Status = 20"

To store this data I have defined a class like this:

Public lngProductNo As Long
Public strProductName As String
Public lngAltProductNo As Long

This again I will store in this matrix:

Dim tabProductInfo() As clsProduct

And here it all stops. I have surfed the web for tips and hints but nothing is working. So is there someone out there who can give me a tips of how I can store the data from my sql-sentence into my matrix?

Best regards

Edvard
 
Use the collections object (you can also use a "collection" class - load the class generator add-in and let it create one for you, as a start to see how it works) [/b][/i][/u][sub]*******************************************************
General remarks:
If this post contains any suggestions for the use or distribution of code, components or files of any sort, it is still your responsibility to assure that you have the proper license and distribution rights to do so!
 

You could also add the data to a 2 dimensional array using the ADO GetRows method. But I assume you want to do this with a class.

I wouldn't try doing this (the collection class) with alot of records...it's actually not a good idea [/b][/i][/u][sub]*******************************************************
General remarks:
If this post contains any suggestions for the use or distribution of code, components or files of any sort, it is still your responsibility to assure that you have the proper license and distribution rights to do so!
 
Not sure what you're trying to get to, but it might be worth looking up User Defined Data type if you don't want all the functionality of a Class Let me know if this helps
________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'There are 10 kinds of people in the world: those who understand binary, and those who don't.'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top