ASP.NET
--
Questions
--
Followers
Top Experts
Pictures not loading
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.
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 = _
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()
Zero AI Policy
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
ASKER CERTIFIED SOLUTION
membership
Log in or create a free account to see answer.
Signing up is free and takes 30 seconds. No credit card required.
SOLUTION
membership
Log in or create a free account to see answer.
Signing up is free and takes 30 seconds. No credit card required.
I was able tofind a solution. Â I used a stored procedure instead. Â But thanks for your help.
connFF = New SqlConnection(Application("connFF"))
Dim cmdLoad As SqlCommand = New SqlCommand("spFFLoadImages", connFF)
cmdLoad.CommandType = CommandType.StoredProcedure
Dim fileName As String
Dim fileType As String
Dim namePosition As Int16
Dim stream As IO.Stream
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
If strcasenumber <> "" Then
CheckDuplicateCaseNumber()
If intcount >= 1 Then
lblmessage.Visible = True
lblmessage.Text = "Report Notes have been previously submitted for casenumber " + strcasenumber + "."
Exit Sub
End If
End If
connFF.Open()
With cmdNotes.Parameters
.Add("@reportdate", dtreportdate)
.Add("@DSFM", strDSFM)
.Add("@casenumber", strcasenumber)
.Add("@county", strcounty)
.Add("@Notes", strnotes)
.Add("@status", strstatus)
.Add("@description", strdescription)
.Add("@image", uploadedFile)
End With






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
ASP.NET
--
Questions
--
Followers
Top Experts
The successor to Active Server Pages, ASP.NET websites utilize the .NET framework to produce dynamic, data and content-driven web applications and services. ASP.NET code can be written using any .NET supported language. As of 2009, ASP.NET can also apply the Model-View-Controller (MVC) pattern to web applications