Dear S056,
We have now completed and released the update to the Aspose.AdHoc component that allows it to support a disconnected data source. This new change should help eliminate any memory issues you have been receiving on the server. The following Blog post gives a brief overview of the new features: http://aspose.com/blogs/Danny.Cooper/archive/2005/05/13/806.aspx
In order to utilize the new disconnected data source feature, you will be required to make code changes. In order to help with the process I have had our team prepare a full code sample that shows how to utilize the new feature. I have pasted it below for your convenience:
' Data Source Connect String
Const ConnectString$ = "server=Nasa2;database=Northwind;User ID=sa;Password=test"
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
' Determine ReLoad
If Not IsPostBack Then
' Set AdHoc component to use Disconnected Data Source
ahMain.DisconnectedData = True
' Assign Data to AdHoc Control
ahMain.DataSource = SQL2DataTable("SELECT TOP 1 * FROM [Invoices]")
ahMain.DataBind()
' Assign Data Source Table / View Name
ahMain.TableName = "Invoices"
End If
End Sub
'* This routine handles the click of the AdHoc finish button
Private Sub ahMain_Finish() Handles ahMain.Finish
' Variables
Dim dtDB As DataTable
' Assign Value
dtDB = ahMain.FilteredDataTable
'** Do DataTable Work Here **'
' Free Memory
dtDB.Dispose()
End Sub
'* This routine handles the request for unique values from the AdHoc component
Private Sub ahMain_ValueRequest(ByVal Field As String, ByVal SQL As String) Handles ahMain.ValueRequest
' Load Unique Values
ahMain.LoadExtValues(SQL2DataReader(SQL))
End Sub
'* This routine converts a SQL statement to a DataTable
Public Shared Function SQL2DataTable(ByVal SQL$) As DataTable
' Variables
Dim cDB As New SqlConnection(ConnectString)
' Append to DataAdapter
Dim daDB As New SqlDataAdapter(SQL, cDB)
' Setup as SQL
daDB.SelectCommand.CommandType = CommandType.Text
' Create and Fill the DataTable
Dim dtDB As New DataTable()
daDB.Fill(dtDB)
' Return the DataTable
Return dtDB
End Function
'* This routine converts a SQL statement to a DataReader
Public Shared Function SQL2DataReader(ByVal SQL$) As SqlDataReader
' Variables
Dim cDB As New SqlConnection(ConnectString)
Dim cmDB As New SqlCommand(SQL, cDB)
' Mark the Command as Text
cmDB.CommandType = CommandType.Text
' Create and Fill the DataSet
cDB.Open()
' Create Data Reader
Dim drDB As SqlDataReader = cmDB.ExecuteReader(CommandBehavior.CloseConnection)
' Return Connection
Return drDB
End Function
All you should need to do is download and install the newest version of the setup file from your personal Full version URL. Please let me know if you encounter any difficulties and I will be more than glad to assist.
Danny Cooper
Team Leader, Aspose Texas Team
Contact Us