SlickUpload
Welcome Guest Search | Active Topics | Log In | Register

SlickUpload w/SQL Server 2005 Options
MikeBeis
#1 Posted : Tuesday, May 06, 2008 3:25:19 PM
Rank: Newbie

Groups: Registered

Joined: 5/6/2008
Posts: 6
Does anyone have a working example of SlickUpload used with a SQL Server, including data table definition? I am not having any luck setting this up at all.
ChrisHynes
#2 Posted : Tuesday, May 06, 2008 5:25:36 PM
Rank: Administration


Groups:

Joined: 7/7/2005
Posts: 1,586
Location: Scottsdale, AZ
Are you trying to use SQL Server to store files? Or to support uploading with progress on a clustered/webfarm environment?
MikeBeis
#3 Posted : Friday, May 09, 2008 8:16:23 AM
Rank: Newbie

Groups: Registered

Joined: 5/6/2008
Posts: 6

I am uploading to a SQL Server 2005. Right now my problem is thatI get the upload window, submit files and the progress panel gets stuck on calculating. Don't know where to go from here.

 

MikeBeis
#4 Posted : Monday, May 12, 2008 8:53:44 AM
Rank: Newbie

Groups: Registered

Joined: 5/6/2008
Posts: 6

I got the progressbar issue fixed. Now I am having problems finding out how to identify the records when the upload is complete. Whe there is an uploadID, why in the world is that not written to the SQL table? How do you identify the FileID's upon completion of the download?

Please help! Issues with the SlickUpload is holding an entire project back right now. 

ChrisHynes
#5 Posted : Tuesday, May 13, 2008 9:10:47 AM
Rank: Administration


Groups:

Joined: 7/7/2005
Posts: 1,586
Location: Scottsdale, AZ

Index into the file's LocationInfo dictionary like so:

string criteria = file.LocationInfo[SqlClientUploadStreamProvider.WhereCriteriaKey];

That will return the where clause used for the record. If you're using the Identity criteria method, you can pull out just the identity ID created like so:

string id = file.LocationInfo[SqlClientUploadStreamProvider.IdentityIdKey];
MikeBeis
#6 Posted : Tuesday, May 13, 2008 8:20:18 PM
Rank: Newbie

Groups: Registered

Joined: 5/6/2008
Posts: 6
I must be completely missing something. Where do you insert those statements?
ChrisHynes
#7 Posted : Tuesday, May 13, 2008 10:31:30 PM
Rank: Administration


Groups:

Joined: 7/7/2005
Posts: 1,586
Location: Scottsdale, AZ

You're using the UploadManager control, right? Add the statements inside the UploadComplete event. You should call e.Status.GetUploadedFiles() to get a list of files (UploadedFile instances) that were uploaded. Then for each UploadedFile (the file reference above), you can call that snippet to get the id.

For example:

protected void uploadManager_UploadComplete(object sender, UploadStatusEventArgs e)
{
   foreach (UploadedFile file in e.Status.GetUploadedFiles())
      {
         string id = file.LocationInfo[SqlClientUploadStreamProvider.IdentityIdKey];

         // do something with the id
      }
}

MikeBeis
#8 Posted : Tuesday, May 13, 2008 11:05:43 PM
Rank: Newbie

Groups: Registered

Joined: 5/6/2008
Posts: 6

Protected Sub uploadManager_UploadComplete(ByVal sender As Object, ByVal e As Krystalware.SlickUpload.Controls.UploadStatusEventArgs) Handles UploadManager.UploadComplete

uploadPanel.Visible = False

Dim Status As UploadStatus = e.Status

If e.Status.Reason = UploadTerminationReason.NotTerminated Then

For Each File As Object In Status.GetUploadedFiles()

MsgBox(File.Locationinfo(???????))      <---------WHAT GOES HERE?  SqlClientUploadStreamProvider is not declared.

Next

resultsMessage.InnerText = "Upload was successful. You may close this window now."

Else

If e.Status.Reason = UploadTerminationReason.Disconnected Then

resultsMessage.InnerText = "Upload was cancelled."

Else

resultsMessage.InnerHtml = "Upload resulted in an error.<br />Reason:" + e.Status.Reason.ToString() + "<br />Message:" + _

e.Status.ErrorMessage

End If

resultsMessage.Style("color") = "red"

End If

End Sub

ChrisHynes
#9 Posted : Tuesday, May 13, 2008 11:33:22 PM
Rank: Administration


Groups:

Joined: 7/7/2005
Posts: 1,586
Location: Scottsdale, AZ

Change the for loop to read:

For Each file As UploadedFile In Status.GetUploadedFiles()
   Dim id As String = file.LocationInfo(SqlClientUploadStreamProvider.IdentityIdKey)
Next file

Then add the following import statements to the top of the file:

Imports Krystalware.SlickUpload
Imports Krystalware.SlickUpload.Status
Imports Krystalware.SlickUpload.Providers
MikeBeis
#10 Posted : Wednesday, May 14, 2008 11:43:44 AM
Rank: Newbie

Groups: Registered

Joined: 5/6/2008
Posts: 6
The first one was missing. Thanks!
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.