troubleshooting Question

Pictures not loading

Avatar of ddrhoward
ddrhoward asked on
ASP.NETVisual Basic.NET
3 Comments2 Solutions210 ViewsLast Modified:
I have a html file that loads the pictures, but whenever I'm step thru my code, it throws up the error....
Connection string not properly initialized.. And truthfully I don't know what to do.
Dim fileName As String
        Dim fileType As String
        Dim namePosition As Int16
        Dim stream As IO.Stream
        Dim conn As New SqlClient.SqlConnection
        Dim Cmd As SqlClient.SqlCommand
        stream = file1.PostedFile.InputStream
        Dim uploadedFile(stream.Length) As Byte
        stream.Read(uploadedFile, 0, stream.Length)
        namePosition = file1.PostedFile.FileName.LastIndexOf("\") + 1
        fileName = file1.PostedFile.FileName.Substring(namePosition)
        fileType = file1.PostedFile.ContentType
        conn.ConnectionString = _
        Dim command As SqlClient.SqlCommand = _
             New SqlClient.SqlCommand( _
                        "INSERT INTO tblFFImages (vchDescription, vchimage, vchcasenumber)Values(@vchdescription, @vchimage, @vchcasenumber", conn)
        command.Parameters.Add _
                ("@vchDescription", _
                SqlDbType.Text).Value = txtdescription.Text
        command.Parameters.Add _
                ("@vchcasenumber", _
                SqlDbType.Int).Value = txtcasenumber.Text
        command.Parameters.Add _
                ("@vchimage", _
                SqlDbType.Image, uploadedFile.Length).Value = uploadedFile

Open in new window


Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 2 Answers and 3 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros