Testo del comando non impostato per l'oggetto comando?

lunedì 06 giugno 2005 - 15.41

lobax Profilo | Junior Member

Form per caricare dati e immagini: Ho provato a debuggare un sacco di volte è tutto valorrizzato voi vedete un errore?
Ricevo: Testo del comando non impostato per l'oggetto comando.

If inputFile.PostedFile.ContentLength > MaxLength Then
Results.InnerHtml = "Il file è di dimensioni troppo elevate. Max " & MaxLength / 1024 & "KB"
'controllo il tipo di file caricato in bytes
ElseIf Not inputFile.PostedFile.ContentType.StartsWith("image") Then
Results.InnerHtml = "Il file non è valido, Dev'essere un'immagine!"
Else
'effettuo un controllo sulle dimensioni dell'immagine
Dim img As System.Drawing.Image = System.Drawing.Image.FromStream(inputFile.PostedFile.InputStream)
If img.Width > MaxWidth OrElse img.Height > MaxHeight Then
Results.InnerHtml = "L'immagine ha dimensioni superiori a quelle consentite. Max " & MaxWidth & "x" & MaxHeight
Else
'se è tutto ok, salvo l'immagine
Dim imgnome As String = Path.GetFileName(inputFile.PostedFile.FileName)
inputFile.PostedFile.SaveAs(Server.MapPath("/immagini/" & imgnome))

If inputFile2.Value <> "" Then
img = System.Drawing.Image.FromStream(inputFile2.PostedFile.InputStream)

Dim nomeimg As String = Path.GetFileName(inputFile2.PostedFile.FileName)
inputFile2.PostedFile.SaveAs(Server.MapPath("/immagini/" & nomeimg))



strsql = "insert into Contents(Content_title, Content_Image, Content_image2," & _
"Content_Description, Content_longDescription, Content_Idcategory, " & _
"Content_status, Content_DataEvento, Content_uid, Content_url) values(?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"



mycommand.Parameters.Add("@Content_title", OleDbType.VarChar, 50).Value = txtTitle.Text
mycommand.Parameters.Add("@Content_Image", OleDbType.VarChar, 100).Value = imgnome
mycommand.Parameters.Add("@Content_Description", OleDbType.VarChar, 1200).Value = TxtDesc.Text
mycommand.Parameters.Add("@Content_longDescription", OleDbType.VarChar, 7600).Value = txtLong.Text
mycommand.Parameters.Add("@Content_Idcategory", OleDbType.Integer, 4).Value = Ddlcat.SelectedValue
mycommand.Parameters.Add("@Content_status", OleDbType.Integer, 4).Value = Ddlstato.SelectedValue
mycommand.Parameters.Add("@Content_DataEvento", OleDbType.Date, 7).Value = TxtWeb.SelectedDate
mycommand.Parameters.Add("@Content_uid", OleDbType.Integer, 4).Value = User.Identity.Name
mycommand.Parameters.Add("@Content_url", OleDbType.VarChar, 20).Value = Ddllink.SelectedItem
mycommand.Parameters.Add("@Content_image2", OleDbType.VarChar, 100).Value = nomeimg
mycommand.ExecuteNonQuery()
conn.Close()
messaggio.Text = "Nuovo record Aggiunto!"
End If
img.Dispose()
End If

End If

Grazie ciao

Brainkiller Profilo | Guru

Su che linea ti da questo errore ?

ciao
david

lobax Profilo | Junior Member

trovato grazie, era perche aprivo la connessione troppo presto, gia che ci sono..come si fa per permettere l'inserimento di un campo "date/time" vuoto?
ciao lob

lobax Profilo | Junior Member

ottimo grazie
Partecipa anche tu! Registrati!
Hai bisogno di aiuto ?
Perchè non ti registri subito?

Dopo esserti registrato potrai chiedere
aiuto sul nostro Forum oppure aiutare gli altri

Consulta le Stanze disponibili.

Registrati ora !
Copyright © dotNetHell.it 2002-2025
Running on Windows Server 2008 R2 Standard, SQL Server 2012 & ASP.NET 3.5