Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Re: Reading Content from Access Database

2 views
Skip to first unread message

Jim Bowman

unread,
Nov 8, 2009, 1:15:14 PM11/8/09
to
For Jeff Rhodes: In your response on 22 Oct 2009, you say, "As you
probably saw in my TBCON examples, you read the db into the server's cache
on the first read. Subsequent users are served straight out of memory..."

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

Jeff Rhodes

unread,
Nov 8, 2009, 5:53:55 PM11/8/09
to
Hi 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

0 new messages