Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2003
    Posts
    2

    Question Unanswered: How to define a table name thru a variable

    Hello,

    I am writing an ASP script to retrieve stock data and store it Oracle. I have been able to successfully retrieve the data and store it in one table. Now I would like to segregate the data in to multiple tables whos names are defined by the variable that holds the stock symbol.

    I am using Oracle 8.1.7, Microsoft OLE DB, Win2K IIS and XP Pro.

    Sincere thanks in advance for any help guidance.
    Murphy

    Here is script I have been working with:
    ==========================================
    Function OracleWrite(TickerID, LastTrade, TradeDate, TradeTime, Change, OpenPrice, DayHigh, DayLow, Volume)

    ' connection and recordset variables
    Dim Cnxn, strCnxn
    Dim rsStocks, strSQLStockDat
    Dim fld, Err


    ' open connection
    Set Cnxn = Server.CreateObject("ADODB.Connection")

    strCnxn = "Provider=msdaora;" & _
    "Data Source=odat;" & _
    "User Id=ouser;" & _
    "Password=opass"

    Cnxn.Open strCnxn

    ' create and open Recordset using object refs
    Set rsStocks = Server.CreateObject("ADODB.Recordset")

    rsStocks.ActiveConnection = Cnxn
    rsStocks.CursorLocation = adUseClient
    rsStocks.CursorType = adOpenKeyset
    rsStocks.LockType = adLockOptimistic
    rsStocks.Source = TickerID
    rsStocks.Open

    rsStocks.AddNew
    rsStocks("TickerID") = CStr(TickerID)
    rsStocks("LastTrade") = CDbl(LastTrade)
    rsStocks("TradeDate") = CStr(TradeDate)
    rsStocks("TradeTime") = CStr(TradeTime)
    rsStocks("Change") = CDbl(Change)
    rsStocks("OpenPrice") = CDbl(OpenPrice)
    rsStocks("DayHigh") = CDbl(DayHigh)
    rsStocks("DayLow") = CDbl(DayLow)
    rsStocks("Volume") = CDbl(Volume)
    rsStocks.Update
    ' check for errors
    If Cnxn.Errors.Count > 0 Then
    For Each Err In Cnxn.Errors
    Response.Write("Error " & Err.SQLState & ": " & _
    Err.Description & " | " & Err.NativeError)
    Next
    Cnxn.Errors.Clear
    rsStocks.CancelUpdate
    End If
    'On Error GoTo 0
    rsStocks.MoveFirst

    Set Cnxn = Nothing
    Set rsStocks = Nothing
    End Function

  2. #2
    Join Date
    Sep 2002
    Location
    UK
    Posts
    5,171
    Provided Answers: 1

    Re: How to define a table name thru a variable

    I have read this post a few times, but still can't understand what the question is. However, what jumps out at me is the phrase:

    Originally posted by murphyld
    Now I would like to segregate the data in to multiple tables whos names are defined by the variable that holds the stock symbol.
    Now that just sounds like a BAD idea! Why would you want a table per stock symbol? Sounds like a waste of effort to me.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •