We help IT Professionals succeed at work.
Get Started

Pictures not loading

ddrhoward asked
Last Modified: 2010-04-14
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

Watch Question
This problem has been solved!
Unlock 2 Answers and 3 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE