Visualizzazione dei risultati da 1 a 2 su 2
  1. #1
    Utente bannato
    Registrato dal
    Jan 2009
    Messaggi
    46

    [c#] Non riesco a modificare un dataset

    Ciao a tutti...

    creo un dataset di ritorno da una query e me lo crea correttamente.

    [TRACCIATURA DEL MIO LOG]
    nome colonna: ID_LOCAZIONE
    valore:P.01.19.5
    nome colonna: ID_SKU
    valore:RRIT9686
    nome colonna: DS_SKU
    valore:BUSTINA CREMA VISO RISTRUTTURANTE NOTTE
    nome colonna: DS_LOTTO
    valore:L08D8
    nome colonna: QT_TOTALE
    valore:12,000
    nome colonna: DT_PRODUZIONE
    valore:24/09/2007 0.00.00
    nome colonna:stato
    valore:




    IL PROBLEMA è IL CAMPO STATO: che è un campo aggiunto

    returnDs_Secondario.Tables[0].Columns.Add("stato", typeof(string));

    DOPODICHE VORREI VALORIZZARLO:

    returnDs_Secondario.Tables[0].Rows[j].ItemArray[6] = "X";

    Però come si vede dal log quel campo rimane sempre vuoto.



    db.connectDb();
    DataSet returnDs_Secondario = db.sqlCommandSelect(query);
    db.closeDbConn();
    if ((returnDs_Secondario != null) && (returnDs_Secondario.Tables[0] != null) && (returnDs_Secondario.Tables[0].Rows.Count != 0))
    {
    logger.Logga("getIntTrack: dati recuperati dal db");
    logger.Logga("righe trovate:" + returnDs_Secondario.Tables[0].Rows.Count.ToString());
    returnDs_Secondario.Tables[0].Columns.Add("stato", typeof(string));
    for (int j = 0; j < returnDs_Secondario.Tables[0].Rows.Count; j++) {
    returnDs_Secondario.Tables[0].Rows[j].ItemArray[6] = "X";

    for(int k = 0; k < returnDs_Secondario.Tables[0].Columns.Count;k++){
    logger.Logga("nome colonna:" + returnDs_Secondario.Tables[0].Columns[k].ColumnName.ToString());
    logger.Logga("valore colonna:" + returnDs_Secondario.Tables[0].Rows[j].ItemArray[k]);
    }
    returnDs.Tables[0].ImportRow(returnDs_Secondario.Tables[0].Rows[j]);
    }
    }

  2. #2
    Utente bannato
    Registrato dal
    Jan 2009
    Messaggi
    46
    Nessuno sa perchè se ne infischia delle mie modifiche?

    Guardando l'item array mi dice che il tipo della nuova colonna è DBNULL

    MA io ho espressamente messo String come tipo nella add

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.