devi soltanto modificare il nome del db access (il percorso anche, eventualmente) e l'istruzione di insert. Com'e' strutturata la tua tabella ?
Al posto delle x e dello 0 mettici i valori che devi mettere (hai postato solo una parte del codice, non so da dove prendi gli altri valori da inserire). Prova cosi'...codice:Protected Sub Inserisci_ServerClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Inserisci.ServerClick If Not Upload.PostedFile Is Nothing And Upload.PostedFile.ContentLength > 0 Then Dim fn As String = System.IO.Path.GetFileName(Upload.PostedFile.FileName) Dim SaveLocation As String = Server.MapPath("..\..\App_Themes\Tema\Images") & "\" & fn Try Upload.PostedFile.SaveAs(SaveLocation) CaricamentoSi.Visible = True Errore.Visible = False Catch Exc As Exception Errore.Visible = True CaricamentoSi.Visible = False End Try Dim ConnString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Server.MapPath("miodb.mdb") Dim cn As New System.Data.OleDb.OleDbConnection(ConnString) cn.Open() Dim comando As New System.Data.OleDb.OleDbCommand comando = New System.Data.OleDb.OleDbCommand("INSERT INTO Vendita (Immagine, Descrizione, Categoria, Tipo, Prezzo) VALUES (SaveLocation,'x','x','x',0)", cn) Try Dim affected As Integer affected = comando.ExecuteNonQuery() If affected > 0 Then Response.Write("Inserimento OK") End If Catch ex As System.Data.OleDb.OleDbException Response.Write("Si è verificato un errore: " & ex.Message) Finally cn.Close() comando.Dispose() End Try Else Response.Write("Please select a file to upload.") End If End Sub

Rispondi quotando