Visualizzazione dei risultati da 1 a 4 su 4

Discussione: Aggiornamento Record

  1. #1

    Aggiornamento Record

    Sto cercando di imparare AspNet utilzzando come editor di base Dreamweaver Mx per poi implementare successivamente il codice a mano.
    Sono riuscito senza problemi a visualizzare i record del Database (Due tabelle:"Categorie" e "dettagli").
    Ora però quando cerco di aggiornare la tabella (Inserimento, aggiornamento o cancellazione dei record) mi restituisce sempre il seguente errore:
    codice:
    System.Data.OleDb.OleDbException: Per l'operazione è necessaria una query aggiornabile. 
    at System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(Int32 hr) 
    at System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult) 
    at System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult) 
    at System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult) 
    at System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method) 
    at System.Data.OleDb.OleDbCommand.ExecuteNonQuery() 
    at DreamweaverCtrls.DataSet.DoInit()
    Ho creato la cartella Bin e copiato nella stessa la DII. Ho letto sul forum che potrebbe un problema di permessi utente ma in quel caso credo che non mi deve far vedere neanche i record.
    Forse devo mettere tutta la cartella principale del sito con le rispettive sottocartelle dentro la cartella Bin.
    Potete dirmi se è un'errore di programmazione o di permessi(nel caso dei permessi mi potreste indicare dive intervenire)
    Ciao e grazie a tutti.

  2. #2

    Re: Aggiornamento Record

    Originariamente inviato da bibuz
    Sto cercando di imparare AspNet utilzzando come editor di base Dreamweaver Mx per poi implementare successivamente il codice a mano.
    Sono riuscito senza problemi a visualizzare i record del Database (Due tabelle:"Categorie" e "dettagli").
    Ora però quando cerco di aggiornare la tabella (Inserimento, aggiornamento o cancellazione dei record) mi restituisce sempre il seguente errore:

    ...

    Ho creato la cartella Bin e copiato nella stessa la DII. Ho letto sul forum che potrebbe un problema di permessi utente ma in quel caso credo che non mi deve far vedere neanche i record.
    Forse devo mettere tutta la cartella principale del sito con le rispettive sottocartelle dentro la cartella Bin.
    Potete dirmi se è un'errore di programmazione o di permessi(nel caso dei permessi mi potreste indicare dive intervenire)
    Ciao e grazie a tutti.
    Potrebbe essere un problema di database. Stai aggiornando una semplice tabella?
    Scrivi il codice ASP.NET con la quale la aggiorni.

  3. #3
    Il codice riferito all'inserimento dati è:
    codice:
    <%@ Page Language="VB" ContentType="text/html" ResponseEncoding="iso-8859-1" %>
    <%@ Register TagPrefix="MM" Namespace="DreamweaverCtrls" Assembly="DreamweaverCtrls,version=1.0.0.0,publicKeyToken=836f606ede05d46a,culture=neutral" %>
    <MM:Insert
    runat="server"
    CommandText='<%# "INSERT INTO formaggi (calorie_totali, carboidrati, coliformi_totali, composizione, conservabilità, escherichia, gusto, id_categorie, id_formaggi, imballaggio, immagine_grande, immagini_piccola, kCalcarboidrati, kCallipidi, kCalproteine, lipidi, listeria, nome, pezzatura, ph, proteine, salmonella, shelflife, stafilococco, stagionatura, struttura, tipo, trattamento, umidita, zuccheri) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)" %>'
    ConnectionString='<%# System.Configuration.ConfigurationSettings.AppSettings("MM_CONNECTION_STRING_roberto") %>'
    DatabaseType='<%# System.Configuration.ConfigurationSettings.AppSettings("MM_CONNECTION_DATABASETYPE_roberto") %>'
    Expression='<%# Request.Form("MM_insert") = "form1" %>'
    CreateDataSet="false"
    SuccessURL='<%# "formaggi.aspx" %>'
    Debug="true"
    >
      <Parameters>
        <Parameter Name="@calorie_totali" Value='<%# IIf((Request.Form("calorie_totali") <> Nothing), Request.Form("calorie_totali"), "") %>' Type="WChar" />
        <Parameter Name="@carboidrati" Value='<%# IIf((Request.Form("carboidrati") <> Nothing), Request.Form("carboidrati"), "") %>' Type="WChar" />
        <Parameter Name="@coliformi_totali" Value='<%# IIf((Request.Form("coliformi_totali") <> Nothing), Request.Form("coliformi_totali"), "") %>' Type="WChar" />
        <Parameter Name="@composizione" Value='<%# IIf((Request.Form("composizione") <> Nothing), Request.Form("composizione"), "") %>' Type="WChar" />
        <Parameter Name="@conservabilità" Value='<%# IIf((Request.Form("conservabilit") <> Nothing), Request.Form("conservabilit"), "") %>' Type="WChar" />
        <Parameter Name="@escherichia" Value='<%# IIf((Request.Form("escherichia") <> Nothing), Request.Form("escherichia"), "") %>' Type="WChar" />
        <Parameter Name="@gusto" Value='<%# IIf((Request.Form("gusto") <> Nothing), Request.Form("gusto"), "") %>' Type="WChar" />
        <Parameter Name="@id_categorie" Value='<%# IIf((Request.Form("id_categorie") <> Nothing), Request.Form("id_categorie"), "") %>' Type="Integer" />
        <Parameter Name="@id_formaggi" Value='<%# IIf((Request.Form("id_formaggi") <> Nothing), Request.Form("id_formaggi"), "") %>' Type="Integer" />
        <Parameter Name="@imballaggio" Value='<%# IIf((Request.Form("imballaggio") <> Nothing), Request.Form("imballaggio"), "") %>' Type="WChar" />
        <Parameter Name="@immagine_grande" Value='<%# IIf((Request.Form("immagine_grande") <> Nothing), Request.Form("immagine_grande"), "") %>' Type="WChar" />
        <Parameter Name="@immagini_piccola" Value='<%# IIf((Request.Form("immagini_piccola") <> Nothing), Request.Form("immagini_piccola"), "") %>' Type="WChar" />
        <Parameter Name="@kCalcarboidrati" Value='<%# IIf((Request.Form("kCalcarboidrati") <> Nothing), Request.Form("kCalcarboidrati"), "") %>' Type="WChar" />
        <Parameter Name="@kCallipidi" Value='<%# IIf((Request.Form("kCallipidi") <> Nothing), Request.Form("kCallipidi"), "") %>' Type="WChar" />
        <Parameter Name="@kCalproteine" Value='<%# IIf((Request.Form("kCalproteine") <> Nothing), Request.Form("kCalproteine"), "") %>' Type="WChar" />
        <Parameter Name="@lipidi" Value='<%# IIf((Request.Form("lipidi") <> Nothing), Request.Form("lipidi"), "") %>' Type="WChar" />
        <Parameter Name="@listeria" Value='<%# IIf((Request.Form("listeria") <> Nothing), Request.Form("listeria"), "") %>' Type="WChar" />
        <Parameter Name="@nome" Value='<%# IIf((Request.Form("nome") <> Nothing), Request.Form("nome"), "") %>' Type="WChar" />
        <Parameter Name="@pezzatura" Value='<%# IIf((Request.Form("pezzatura") <> Nothing), Request.Form("pezzatura"), "") %>' Type="WChar" />
        <Parameter Name="@ph" Value='<%# IIf((Request.Form("ph") <> Nothing), Request.Form("ph"), "") %>' Type="WChar" />
        <Parameter Name="@proteine" Value='<%# IIf((Request.Form("proteine") <> Nothing), Request.Form("proteine"), "") %>' Type="WChar" />
        <Parameter Name="@salmonella" Value='<%# IIf((Request.Form("salmonella") <> Nothing), Request.Form("salmonella"), "") %>' Type="WChar" />
        <Parameter Name="@shelflife" Value='<%# IIf((Request.Form("shelflife") <> Nothing), Request.Form("shelflife"), "") %>' Type="WChar" />
        <Parameter Name="@stafilococco" Value='<%# IIf((Request.Form("stafilococco") <> Nothing), Request.Form("stafilococco"), "") %>' Type="WChar" />
        <Parameter Name="@stagionatura" Value='<%# IIf((Request.Form("stagionatura") <> Nothing), Request.Form("stagionatura"), "") %>' Type="WChar" />
        <Parameter Name="@struttura" Value='<%# IIf((Request.Form("struttura") <> Nothing), Request.Form("struttura"), "") %>' Type="WChar" />
        <Parameter Name="@tipo" Value='<%# IIf((Request.Form("tipo") <> Nothing), Request.Form("tipo"), "") %>' Type="WChar" />
        <Parameter Name="@trattamento" Value='<%# IIf((Request.Form("trattamento") <> Nothing), Request.Form("trattamento"), "") %>' Type="WChar" />
        <Parameter Name="@umidita" Value='<%# IIf((Request.Form("umidita") <> Nothing), Request.Form("umidita"), "") %>' Type="WChar" />
        <Parameter Name="@zuccheri" Value='<%# IIf((Request.Form("zuccheri") <> Nothing), Request.Form("zuccheri"), "") %>' Type="WChar" />
      </Parameters>
    </MM:Insert>
    <MM:DataSet 
    id="aggFormaggi"
    runat="Server"
    IsStoredProcedure="false"
    ConnectionString='<%# System.Configuration.ConfigurationSettings.AppSettings("MM_CONNECTION_STRING_roberto") %>'
    DatabaseType='<%# System.Configuration.ConfigurationSettings.AppSettings("MM_CONNECTION_DATABASETYPE_roberto") %>'
    CommandText='<%# "SELECT * FROM formaggi WHERE id_formaggi = ?" %>'
    Debug="true"
    > 
      <Parameters> 
        <Parameter  Name="@id_formaggi"  Value='<%# IIf((Request.QueryString("id_formaggi") <> Nothing), Request.QueryString("id_formaggi"), "") %>'  Type="Integer"   /> 
      </Parameters>
    </MM:DataSet>
    <MM:PageBind runat="server" PostBackBind="true" />
    <html>
    <head>
    <title>Documento senza titolo</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>
    <body>
    <table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td align="center" valign="middle">
          <form method="post" name="form1" runat="server">
            <table align="center">
              <tr valign="baseline">
                <td nowrap align="right">Calorie_totali:</td>
                <td>
                  <asp:textbox id="calorie_totali" TextMode="SingleLine" Columns="32" runat="server" />      
          </td>
              </tr>
              <tr valign="baseline">
                <td nowrap align="right">Carboidrati:</td>
                <td>
                  <asp:textbox id="carboidrati" TextMode="SingleLine" Columns="32" runat="server" />      
          </td>
              </tr>
    ................................

  4. #4
    Utente di HTML.it
    Registrato dal
    Aug 2001
    Messaggi
    1,482
    leggi la faq 5

    E se hai problemi rispondi pure in quel thread.

    questo lo chiudo.


    Hey hey, my my Rock and roll can never die!

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 © 2025 vBulletin Solutions, Inc. All rights reserved.