Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Offline database........?

Offline database........?

Scheduled Pinned Locked Moved Visual Basic
databasequestionoraclehelp
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • O Offline
    O Offline
    opusxxvii
    wrote on last edited by
    #1

    Let's say I have 3 columns: stock symbol, current price, last price. I want to be able to enter the stock symbol and then my app retrieves the current price and last price from, let's say, yahooFinance. In effect I am creating a database by entering ONLY the stock symbol, without access to or connecting with an external database per se (Oracle, SQL, etc). The app populates the remaining fields from the yahooFinance web site and refreshes that information within a predetermined amount of time. I'm brand new to VB so I'd love some guidance with this problem. Also, curious about column sizing. The datagrid properties change each column to the identical size. How can I customize the size of each column seperately? Thanks.

    D 1 Reply Last reply
    0
    • O opusxxvii

      Let's say I have 3 columns: stock symbol, current price, last price. I want to be able to enter the stock symbol and then my app retrieves the current price and last price from, let's say, yahooFinance. In effect I am creating a database by entering ONLY the stock symbol, without access to or connecting with an external database per se (Oracle, SQL, etc). The app populates the remaining fields from the yahooFinance web site and refreshes that information within a predetermined amount of time. I'm brand new to VB so I'd love some guidance with this problem. Also, curious about column sizing. The datagrid properties change each column to the identical size. How can I customize the size of each column seperately? Thanks.

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      It sounds like your going to be scraping a web page for your data. It can be done, but be very careful about how you go about finding the data you want in the page. When, not if, when Yahoo or any other source, changes the page layout, it'll most likely break your app. RageInTheMachine9532

      O 1 Reply Last reply
      0
      • D Dave Kreskowiak

        It sounds like your going to be scraping a web page for your data. It can be done, but be very careful about how you go about finding the data you want in the page. When, not if, when Yahoo or any other source, changes the page layout, it'll most likely break your app. RageInTheMachine9532

        O Offline
        O Offline
        opusxxvii
        wrote on last edited by
        #3

        Yes, that's it...I want to scrape a web page for my data. Fortunately the site is quite consistent so I do not anticipate having to change my code very often. However, how do I "scrape" a web site? Which method to I employ? What's the best?

        D 1 Reply Last reply
        0
        • O opusxxvii

          Yes, that's it...I want to scrape a web page for my data. Fortunately the site is quite consistent so I do not anticipate having to change my code very often. However, how do I "scrape" a web site? Which method to I employ? What's the best?

          D Offline
          D Offline
          Dave Kreskowiak
          wrote on last edited by
          #4

          "Scrape"ing is grabbing a page and searching through it looking for certain tags or other strings that either delineate the information you want or point to the information you want. In other words, you'll treat the page source (HTML) as a string and search that string for substrings that represents the data you want, or the tags around it. For example:

          Last Trade:28.01Trade Time:4:00PM ETChange:Down 0.29 (1.02%)

          This is just a few lines of the 38,000 characters returned by Yahoo Finance to display the data for a quote on Microsoft. There are 3 bits of useful information in this snippet. The "Last Trade", "Trade Time", and "Change". Find them... I'l wait. Now, you can use the strings "Last Trade", "Trade Time", and "Change" to find where the information is, but it doesn't give you the information you want. Once you find the string "Last Trade", you have to skip a bunch of stuff before you can actually get to the data you need, 28.01. The problem is how do you RELIABLY skip to that piece of information? Hint: The web page isn't as stable as it appears! You might want to look at this MSDN article[^] first before deciding whether or not this method is acceptable. RageInTheMachine9532

          D 1 Reply Last reply
          0
          • D Dave Kreskowiak

            "Scrape"ing is grabbing a page and searching through it looking for certain tags or other strings that either delineate the information you want or point to the information you want. In other words, you'll treat the page source (HTML) as a string and search that string for substrings that represents the data you want, or the tags around it. For example:

            Last Trade:28.01Trade Time:4:00PM ETChange:Down 0.29 (1.02%)

            This is just a few lines of the 38,000 characters returned by Yahoo Finance to display the data for a quote on Microsoft. There are 3 bits of useful information in this snippet. The "Last Trade", "Trade Time", and "Change". Find them... I'l wait. Now, you can use the strings "Last Trade", "Trade Time", and "Change" to find where the information is, but it doesn't give you the information you want. Once you find the string "Last Trade", you have to skip a bunch of stuff before you can actually get to the data you need, 28.01. The problem is how do you RELIABLY skip to that piece of information? Hint: The web page isn't as stable as it appears! You might want to look at this MSDN article[^] first before deciding whether or not this method is acceptable. RageInTheMachine9532

            D Offline
            D Offline
            Dr_X
            wrote on last edited by
            #5

            Here is something I was playing around with last week. Give it a try. Just pass a list of comma delimited stock quotes to the function. It will return a list of all the quotes with each item having the details of the stock in a comma delimited format: symbol, last trade time, last value, open value, PE, etc... The downside it is not in realtime. Public Function GetQuote(ByVal symbols As String) As StockDetails Dim url As String = "http://quote.yahoo.com/d/quotes.csv?s=" & symbols & "&d=t&f=sl1d1t1c1ohgvj1pp2wern" 'stores url of yahoo quote engine Dim buffer As String Dim webRequest As WebRequest Dim webResponse As WebResponse webRequest = HttpWebRequest.Create(url) webResponse = webRequest.GetResponse() Dim sr As StreamReader = New StreamReader(webResponse.GetResponseStream, System.Text.Encoding.ASCII) buffer = sr.ReadToEnd() sr.Close() Return buffer End Function This should be much easier than obtaining values from an existing web page. Michael

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups