locked
Insert into SQL Table using PictureBox1.ImageLocation RRS feed

  • Question

  • User1717218719 posted

    I have the followingcode and I am looking to insert the image file to my sql database that has been unploaded to azure storage.

    I am coding in vb

     Private Async Sub btnSave_Click(sender As Object, e As EventArgs) Handles btnSave.Click
    
            Try
                ToolStripStatusLabel1.Text = "Uploading"
                Await Task.Delay(txtDelay.Text)
    
                Dim AZBlob As New AzureBlob(ConfigurationManager.AppSettings(StorageConnectionString), mycontainer)
    
                Await AZBlob.UploadAsync(PictureBox1.ImageLocation, cancelToken)
    
    
                '---Insert in SQL Table using PictureBox1.ImageLocation
    my table has the columns:
    Id
    FileUrl
    FileData
    OriginalName
    ContentType
    DateCreated ToolStripStatusLabel1.Text = "" PictureBox1.Image = Nothing Catch exCancel As OperationCanceledException Dim message As String = "upload canceled at Form" MessageBox.Show(message) ToolStripStatusLabel1.Text = message Catch ex As Exception MessageBox.Show(ex.Message) ToolStripStatusLabel1.Text = ex.Message End Try End Sub

    Wednesday, January 22, 2020 12:34 PM

Answers

  • User2053451246 posted

    You are using controls that are not web controls so you must be doing a windows application.  This is a forum for ASP.Net, which does not include PictureBox, and MessageBox calls would show on the web server, which is obviously a problem.

    Visit MSDN forums for the technology you are programming in:

    https://social.msdn.microsoft.com/Forums/en-US/home

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, January 22, 2020 3:21 PM