Visualizzazione dei risultati da 1 a 3 su 3
  1. #1

    Aggiornare Dati DataSet

    Buongiorno Ragazzi ho un problema penso abbastanza semplice...cioè:
    non riesco ad aggiornare il db dopo aver aggiornato il Dataset.

    Il faccio cosi:
    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    'Put user code to initialize the page here
    If Request("id") <> "" Then
    Dim Connessione As OleDbConnection
    Dim adp As OleDbDataAdapter
    Dim ds As DataSet
    Dim sql As String
    Connessione = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; " & _
    "Data Source=" + Server.MapPath("/Gestione Impactweb/Gestione.mdb"))
    Connessione.Open()
    sql = "Select * From Scadenze where idscadenza=" & Request("id")
    adp = New OleDbDataAdapter(sql, Connessione)
    ds = New DataSet
    adp.Fill(ds, "Scadenze")
    Dim Data As String = ds.Tables("scadenze").Rows(0).Item("DataScadenza")
    Dim Titolo As String = ds.Tables("scadenze").Rows(0).Item("Titolo")
    Dim Descrizione As String = ds.Tables("scadenze").Rows(0).Item("Descrizione")
    Titolo_Form.Text = Titolo
    Descrizione_form.Text = Descrizione
    data_scadenza_form.Text = Data
    ds.Tables("scandenza").Rows("0").Item("Titolo") = "TITOPOOOOOO"

    Dim bulder As New OleDb.OleDbCommandBuilder(adp)
    adp.Update(ds, "Scadenze")


    End If
    End Sub


    COSI FACENDO MI DA ERRORE MA SE PROVO A STAMPARE IL DATASET QUESTO RISULTA AGGIORNATO COME POSSO FAR AGGIORNARE ANCHE IL DATABASE??

    GRAZIE MILLE A TUTTI
    E BUON LAVORO

    MARCO

  2. #2
    Moderatore di ASP.net L'avatar di djciko
    Registrato dal
    Nov 2002
    Messaggi
    6,887
    codice:
    ds.Tables("scandenza").Rows("0").Item("Titolo") = "TITOPOOOOOO"
    come mai qui l'hai chiamata scadenza ed in filling scadenze ?

  3. #3
    Originariamente inviato da djciko
    codice:
    ds.Tables("scandenza").Rows("0").Item("Titolo") = "TITOPOOOOOO"
    come mai qui l'hai chiamata scadenza ed in filling scadenze ?
    Hai ragione avevo sbagliato, ma cmq l'errore che mi veniva fuori è questo e non riguarda quella riga:

    Object reference not set to an instance of an object.
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

    Source Error:

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

    Stack Trace:


    AIUTATEMI
    GRAZIE MILLE

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2026 vBulletin Solutions, Inc. All rights reserved.