Ciao a tutti forumisti. Come da titolo mi occorreva sapere come riuscire a scrivere su un database.

Questo è un codice prelevato dalla rete e nonostante sono riuscito a "leggere i dati" con facilità utilizzando il codice con alcune modifiche, non riesco però a scrivere all' interno di un mio DATABASE che ha una lista di indirizzi inseriti in unico CAMPO.



Imports System.Data.OleDb

Partial Class Registrazione

Inherits System.Web.UI.Page
Dim cn As OleDbConnection
Dim cmd As OleDbCommand
Dim dr As OleDbDataReader
Dim icount As Integer
Dim str As String

Protected Sub bInvia_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles bInvia.Click

cn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("NOMEDELMIODATABASE.mdb"))
cn.Open()
str = "INSERT INTO TABELLA VALUES ('" & tIndirizzo.Text & "')"

'string stores the command and CInt is used to convert number to string
cmd = New OleDbCommand(str, cn)

icount = cmd.ExecuteNonQuery

******* 'L' ERRORE E' PROPRIO NELLA STRINGA DI DI SOPRA
--- Errore di sintassi nell'istruzione INSERT INTO. ---
OLEDBEXCEPTION NON è STATA GESTITA DAL CODICE UTENTE



MsgBox(icount)
'displays number of records inserted

cn.Close()
End Sub

End Class


SPERO DI ESSERE STAO CHIARO.
GRAZIE PER L' ATTENZIONE SPERO CHE QUALCUNO MI AIUTI.