ciao,
ho creato un form che faccia anche upload da file, oltre ad inserire i dati di due textbox.
riesco a fare l'upload del file in una data cartella, ma non so codice e sintassi per fare l'INSERT INTO nella tabella del db.
per un esperto credo sia banale.
il codice della pagina .vb è il seguente
dati textbox1 e textbox2 i nomi delle textbox dal form, cosa devo scrivere?codice:Private Sub Submit1_ServerClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Submit1.ServerClick If Not File1.PostedFile Is Nothing And File1.PostedFile.ContentLength > 0 Then Dim fn As String = System.IO.Path.GetFileName(File1.PostedFile.FileName) Dim SaveLocation As String = Server.MapPath("..\upload") & "\" & Session.SessionID & fn Try File1.PostedFile.SaveAs(SaveLocation) Response.Write("The file has been uploaded.") Catch Exc As Exception Response.Write("Error: " & Exc.Message) End Try Else Response.Write("Please select a file to upload.") End If End Sub
grazie mille!

Rispondi quotando