ndraycott 0 Newbie Poster

I am looking to retrieve and play video files from a database. The url and not the binary data is stored in the database. I previously managed the download file when they were stored in the binary format, but now to increase performance I want to just link to the file stored on the server.
I have some of the code I used before, but want to alter it to get it to find the VideoUrl and not the VideoData or MIME type from the database.

Thanks in advance

Protected Sub ImageButton1_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ImageButton1.Click
        Dim strQuery As String = "select VideoName, VideoUrl from video where UserNo=@UserNo"
        Dim cmd As SqlCommand = New SqlCommand(strQuery)
        cmd.Parameters.Add("@UserNo", SqlDbType.Int).Value = 1

        Dim dt As DataTable = GetData(cmd)
        If dt IsNot Nothing Then
        End If

    End Sub
    Private Sub getData(ByVal user As String)
        Dim dt As New DataTable()
        Dim connection As New SqlConnection("ConnectionString")
        Dim sqlCmd As New SqlCommand("SELECT * from video WHERE UserNo = 1", connection)
        Dim sqlDa As New SqlDataAdapter(sqlCmd)

        sqlCmd.Parameters.AddWithValue("@UserNo", user)
        If dt.Rows.Count > 0 Then

            lblVid1.Text = dt.Rows(0)("VideoName").ToString()

        End If
    End Sub

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
        If Not Page.IsPostBack Then
        End If

    End Sub
    Public Function GetData(ByVal cmd As SqlCommand) As DataTable
        Dim dt As New DataTable
        Dim strConnString As String = System.Configuration.ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString
        Dim con As New SqlConnection(strConnString)
        Dim sda As New SqlDataAdapter
        cmd.CommandType = CommandType.Text
        cmd.Connection = con
            sda.SelectCommand = cmd
            Return dt
        Catch ex As Exception
            Return Nothing
        End Try
    End Function

    Protected Sub download(ByVal dt As DataTable)
        'Dim url() As Byte = CType(dt.Rows(0)("MIME"), Byte())
        'Response.Buffer = True
        'Response.Charset = ""
        ''Response.ContentType = dt.Rows(0)("MIME").ToString()
        ''Response.AddHeader("content-disposition", "attachment;filename=" & dt.Rows(0)("VideoName").ToString())
    End Sub
Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.