In looking through your TBCON 08 session, "HTTP Post with Toolbook
and .NET", I can find examples of code using Connection, Command and
DataReader Objects. But I'm unable to find examples of DataAdapter and
DataSet objects for use in an asp.net page. Can you steer me to the
appropriate TBCON example that illustrates reading a db into the server's
cache?
Thanks.
Jim
A better example of using cache would be in the "Communicating with .NET Web
Services from Flash" session from TBCON 2008. The zip you want is
eLearningWebService.zip. In it, the web service gets the FacultyDataTable
property as shown below:
Private Property FacultyDataTable() As DataTable
Get
Dim dataTableId As DataTable
If IsNothing(Current.Cache("FacultyDataTable")) = True Then
dataTableId = Me.GetConferenceDataTable(Me.ConStrBase,
"FacultyQuery")
Current.Cache("FacultyDataTable") = dataTableId
Else
dataTableId = CType(Current.Cache("FacultyDataTable"),
DataTable)
End If
Return dataTableId
End Get
Set(ByVal Value As DataTable)
Current.Cache("FacultyDataTable") = Value
End Set
End Property
If the table is not cached in memory, then we call the
GetConferenceDataTable function:
Private Function GetConferenceDataTable(ByVal baseString As String, ByVal
procedureName As String) As DataTable
Dim dbName As String = String.Format("tbcon_{0}.mdb",
currentConferenceYear)
Dim conStr As String = String.Concat(baseString, dbName)
Dim dataTableId As New DataTable
oledbConId = New OleDbConnection(conStr)
If oledbConId.State <> ConnectionState.Open Then
oledbConId.Open()
End If
Dim dbCommand As New OleDbCommand(procedureName, oledbConId)
Dim adapterId As New OleDbDataAdapter(dbCommand)
dbCommand.CommandType = CommandType.StoredProcedure
adapterId.Fill(dataTableId)
dataTableId.TableName = "FacultyMember"
oledbConId.Close()
Return dataTableId
End Function
I hope this helps,
Jeff Rhodes
Platte Canyon Multimedia Software Corporation
"Improving the Lives of Training Developers"
http://www.plattecanyon.com
Plug-In Pro for ToolBook
http://www.plattecanyon.com/pluginpro.aspx
TBK Tracker
http://www.tbktracker.com
Programming for e-Learning Developers: ToolBook, Flash, JavaScript, and
Silverlight
http://www.plattecanyon.com/programmingbook.aspx
The e-Learning Authoring Conference
June 14 - 16, 2010
http://www.elearncon.net