Increase Connection Timeout


Author
Message
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Cool.  It is cool watching it show the progress while updating a single field, huh?  I still enjoy uploading large files where we have this implemented just so I can watch it progress BigGrin
Kenneth Langley
Kenneth Langley
StrataFrame Novice (52 reputation)StrataFrame Novice (52 reputation)StrataFrame Novice (52 reputation)StrataFrame Novice (52 reputation)StrataFrame Novice (52 reputation)StrataFrame Novice (52 reputation)StrataFrame Novice (52 reputation)StrataFrame Novice (52 reputation)StrataFrame Novice (52 reputation)
Group: StrataFrame Users
Posts: 26, Visits: 1.5K
Thanks Trent

We have this working well now, thanks for the help

Kenneth langley

Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
You can go at this a number of ways, but here is a quick sample.  Let's first put a method on the BO where the varbinary field resides:

BO Method

''' <summary>
''' Updates a blob or binary field on a thread with callback methods updating the progress
''' </summary>
Public Sub UpdateBlobData(ByVal pk As Integer, _
      ByVal data As Byte(), _
      ByVal displayText As String, _
                           ByVal progressCallback As BlobProgressDelegate, _
      ByVal completeCallBack As BlobPushCompleteDelegate, _
      ByVal errorCallback As BlobErrorDelegate)
'-- Establish Locals
Dim pkValue As New MicroFour.StrataFrame.Business.PrimaryKeyValue(New Object() {pk})

'-- Start the update progress
Me.PushBlobFieldAsync(pkValue, _
        "FieldName", _
        data, _
        84000, _
        displayText, _
        progressCallback, _
        completeCallBack, _
        errorCallback)
End Sub

In this example, the above field name is "FieldName" so we would add "FieldName" to the FieldsToExcludeFromUpdate and FieldsToExcludeFromInsert.  This way the PK, time stamp columns, etc. would save before we try to save our blob data.  So taking this example, and assuming that you have added the "FieldName" to the FieldsToExclude properties on the BO, the code would look something like this:


'-- Save the BO data to the server minus the blob field.  The Blob field will not be included because
'    it should have been added to the FieldsToExcludeFrom... properties.
MyBO.Save()

'-- Now that all other fields of the BO have been saved, it is time to save the blob data
MyBO.UpdateBlobData(MyBO.PrimaryKeyField, _
                              BlobDataAsByteArray, _
                              "Saving large data", _
                              AddressOf HandlePushProgress, _
                              AddressOf HandlePushComplete, _
                              AddressOf HandlePushError)

''' <summary>
''' Handles the completion of a push of a media item to the serve
''' </summary>
Private Sub HandlePushComplete(ByVal state As Object)
 '-- Place any post push logic here (i.e. update the dialog, start a new update, etc.)
End Sub

''' <summary>
''' Handles an error in the push process
''' </summary>
Private Sub HandlePushError(ByVal ex As Exception, ByVal state As Object)
 MicroFour.StrataFrame.Application.StrataFrameApplication.ShowRedExceptionDialog(ex)
End Sub

''' <summary>
''' Handles the progress of an upload or download from the server
''' </summary>
Private Sub HandlePushProgress(ByVal currentCount As Long, ByVal totalCount As Long, ByVal nextIncrement As Byte(), ByVal state As Object)
 '-- Update the progress
 lblProgress.Text = CType(state, String)
 
 '-- Update the thermo
 Try
     '-- Don't let the progress go above the max value
     If prgProgress.Value > totalCount Then prgProgress.Value = totalCount
 
     prgProgress.Maximum = totalCount
     prgProgress.Value = currentCount
 Catch ex As Exception
 End Try
End Sub

That should give you a good starting point.

Kenneth Langley
Kenneth Langley
StrataFrame Novice (52 reputation)StrataFrame Novice (52 reputation)StrataFrame Novice (52 reputation)StrataFrame Novice (52 reputation)StrataFrame Novice (52 reputation)StrataFrame Novice (52 reputation)StrataFrame Novice (52 reputation)StrataFrame Novice (52 reputation)StrataFrame Novice (52 reputation)
Group: StrataFrame Users
Posts: 26, Visits: 1.5K
Trent

I cannot find any documentation for the push/pull BLOB functions you referenced. Could you please give us a sample or point me to where it is used.

Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Good point.  Yes, they should.
Edhy Rijo
E
StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Hi Trent,

When using the Push/Pull methods should the VarBinary fields be included in the BO FieldsToExcludeFromInsert and FieldsToExcludeFromUpdate properties?



Edhy Rijo

Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Guys, sorry for the super delayed response here.  We have not been in the office (and still aren't) and I have not been able to get the forum until now.

Let me propose another avenue that is much more beneficial to you and the end-user when waiting for large VarBinary(MAX) fields.  StrataFrame has two push methods and two pull methods for this very purpose called: PushBlobField, PushBlobFieldAsync, PullBlobField, and PullBlobFieldAsync.

Whether you choose to use the async method or block and use the non-async methods, this will never timeout and will stream as big of a file that you will ever use.  If you use the async method (which I recommend) you can also add handlers to show a progress bar of the save and/or retrieval.

Push Async Example

MyBO.PushBlobFieldAsync(PkValueToUpdate, "DataField", byteData, 84000, displayText, progressCallback, completeCallBack, errorCallback)

The pull will work very much like the push.  This is a great method and is what we do when updating large binary data fields....that is how this made it into the framework Smile

Larry Caylor
Larry Caylor
StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)
Group: Awaiting Activation
Posts: 592, Visits: 3.7K
You may also want to look at your database maintenance plan and make sure that the statistics are being refreshed or try analyzing your query in the database engine tuning advisor. I've seen a query drop from 30+ seconds to under a second after tunng. You may also want to consider using the SF Enterprise server to eliminate the database traffic between the client and DB server over your wide area network.

-Larry

Peter Jones
Peter Jones
Advanced StrataFrame User (504 reputation)Advanced StrataFrame User (504 reputation)Advanced StrataFrame User (504 reputation)Advanced StrataFrame User (504 reputation)Advanced StrataFrame User (504 reputation)Advanced StrataFrame User (504 reputation)Advanced StrataFrame User (504 reputation)Advanced StrataFrame User (504 reputation)Advanced StrataFrame User (504 reputation)
Group: Forum Members
Posts: 386, Visits: 2.1K
Hi Bill,

Just looked at the code in your post and the line:

cmd.Parameters.AddWithValue("@invdate", InvDateDE.DateTime.ToShortDateString()).SqlDbType = SqlDbType.VarChar;

may need attention IF InvDate is an indexed column in your database. If it is then the parameter must a Date data type not VarChar.

If you need to pass in a VarChar data type then your proc needs to convert the value to a date data type before it is used in a Where clause. If this isn't done you will end up with a full table scan rather than a Seek on your InvDate index.

Cheers, Peter


Peter Jones
Peter Jones
Advanced StrataFrame User (504 reputation)Advanced StrataFrame User (504 reputation)Advanced StrataFrame User (504 reputation)Advanced StrataFrame User (504 reputation)Advanced StrataFrame User (504 reputation)Advanced StrataFrame User (504 reputation)Advanced StrataFrame User (504 reputation)Advanced StrataFrame User (504 reputation)Advanced StrataFrame User (504 reputation)
Group: Forum Members
Posts: 386, Visits: 2.1K
Hi Bill,

You could try putting:

Option (Recompile)

as the last line in your proc. This will cause SQL to recalculate its execution plan each time the proc runs. While this, in itself is an overhead, it is better than using an old and entirely inappropriate plan if you have a wide range of options that SQL should be considering on each execution although SQL is supposed to be pretty smart in knowing when to recalculate an execution plan.

Bottom line is that 90 seconds is a looooong time and the issue is probably in the area of your proc using full table scans rather than index seeks. Just in case you don't know - the best way to sort these issues is to put the proc's code is Query Analyzer and have a look at the Execution Plan

Cheers, Peter

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search