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