[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Need help caching a couple of rows from SQL at runtime for lookups

Posted on 2006-05-23
3
Medium Priority
?
257 Views
Last Modified: 2010-04-23
Hi,
I need to cache a lookup table from SQL which will contain roughly 10 rows, at runtime. I also need a function to lookup the data based on the input..
for Example
I cache a table that looks like this
warehouseid   warehousename
1                       new york
2                       florida
3                       california

etc...
i then want to look this up quickly without having to go back to the sql to get the data-- as this data is static and does not change often--but hardcoding it would be pretty stupid.....
Thanks!
0
Comment
Question by:moruda
3 Comments
 
LVL 34

Accepted Solution

by:
Brian Crowe earned 2000 total points
ID: 16748198
Private ds as new dataset

...

Private Sub LoadLookup()
   Dim da as new sqldataadapter
   
   with da
      .selectcommand = new sqlcommand
      with .selectcommand
         .connection = {your connection}
         .commandtext = "SELECT warehouseid, warehousename FROM myTable"
      end with
      .acceptchangesduringfill = true
      .tablemappings.add("Table", "Warehouse")
   end with

   try
      da.fill(ds)
   catch ex as exception
      messagebox.show("Error Loading Warehouse Data: " + ex.message)
   end try
end sub

the data is now loaded into a datatable called "Warehouse" in the ds DataSet
0
 
LVL 19

Expert Comment

by:arif_eqbal
ID: 16748645
Its not a Web App right ??
0
 

Author Comment

by:moruda
ID: 16751182
it is not a web app. it's vb.net
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
Loops Section Overview
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses
Course of the Month18 days, 23 hours left to enroll

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question