ciao a tutti,
sono un paio di ore che sono qui sopra a questo errore..
Dynamic SQL generation for the UpdateCommand is not supported against a SelectCommand that does not return any key column information.
Praticamente stò facendo l'update di un data adapter contenente un dataset con una tabella generata da "select * from Utenti "
perciò contenente tutti i campi
ho visto e rivisto il codice ma dà sempre questo errore ...sapete dirmi come mai?
grazie
ps:questo è il codice
codice:Dim id As String = Session.Item("id") Dim cn As New SqlClient.SqlConnection(System.Configuration.ConfigurationSettings.AppSettings("CnString")) Dim da As New SqlClient.SqlDataAdapter("select * from Utenti", cn) Dim ds As New DataSet da.Fill(ds, "MyPData") da.FillSchema(ds, SchemaType.Source) Dim riga As DataRow Dim i As Integer = 0 For Each riga In ds.Tables("MyPData").Rows If riga("ID") = id Then riga("Nome") = txtNome.Text riga("Cognome") = txtCognome.Text riga("Via") = txtVia.Text riga("Citta") = txtCitta.Text riga("Cap") = txtCap.Text If txtTelefono.Text.Length > 6 Then riga("TelefonoFisso") = txtTelefono.Text End If If txtFax.Text.Length > 6 Then riga("Fax") = txtFax.Text End If ds.Tables("MyPData").Rows(i)("Mail") = txtMail.Text If txtCellulare.Text.Length > 6 Then riga("Cellulare") = txtCellulare.Text End If If txtFiscale.Text.Length > 10 Then riga("CodFicale") = txtFiscale.Text End If If txtIva.Text.Length > 10 Then riga("PIva") = txtIva.Text End If If txtOldPass.Text <> "" Then ValidatePass.Enabled = True If txtNewPass1.Text.Length < 6 Then lblMessage.Text = "La password deve essere di almeno 6 caratteri" Exit Sub Else riga("Pasw") = txtNewPass1.Text End If End If If DropNazione.SelectedValue <> "" Then riga("Nazione") = DropNazione.SelectedValue.ToString End If If dropProvincia.SelectedValue <> "" Then riga("Provincia") = dropProvincia.SelectedValue.ToString End If If txtIva.Text.Length < 10 Then CodFiscPIva.Enabled = True Else CodFiscPIva.Enabled = False End If Dim Upz As New SqlClient.SqlCommandBuilder(da) da.Update(ds, "MyPData") Exit For End If i += 1 Next riempiCampi() lblMessage.Text = "dati aggiornati con successo"

Rispondi quotando