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 = _ ConfigurationSettings.AppSettings("ConnectionString") conn.Open() 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 command.ExecuteNonQuery() conn.Close()
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.
When asked, what has been your best career decision?
Deciding to stick with EE.
Being involved with EE helped me to grow personally and professionally.
Connect with Certified Experts to gain insight and support on specific technology challenges including:
We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE