Datatabler

giovedì 04 giugno 2009 - 11.08

pasqualimassimo Profilo | Junior Member



ciao sentite sto impazzendo voglio, ho un progetto con un dataset e voglio creare una dll che mi gestisca l'inserimento, la cancellazione, ecc...

ora la dll l'ho creata solo che quando istanzio l'oggetto della classe sottostante non risesco ha passargli il datatabler


avete delle idee ?

istanzio la classe :

DB = gcnew Class1(this->cassaDataSet,
this->cassaDataSet->colori,
CreateDataReader,
this->coloriTableAdapter,
::Convert::ToString("colori"),
campiMaschera);


questa è la classe nella dll

public ref class Class1
{
public:
//DEFINISCO DELLE VARIABILI PUBBLICHE
System::Data::DataSet^ dataSetCassa;
System::Data::DataTable^ tableCassa;
System::Data::Common::DataAdapter^ tabellaAdapter;
System::Data::DataTableReader^ readerTabella;
System::Data::DataRow ^ rigaTabella;
String^ nomeTabella;
String ^ modifica;
array<String^ >^ campiTabella;
array<String^ >^ campiMaschera;

Class1(System::Data::DataSet^ dataSetCassa,
System::Data::DataTable^ tableCassa,
System::Data::DataTableReader^ readerTabella,
System::Data::Common::DataAdapter^ tabellaAdapter,
String^ nomeTabella,
array<String^ >^ campiMaschera)
{

//
//TODO: Add the constructor code here
//
this->dataSetCassa = dataSetCassa;
this->tableCassa = tableCassa;
this->readerTabella = readerTabella;
this->tabellaAdapter = tabellaAdapter;
this->nomeTabella = nomeTabella;
this->campiMaschera = campiMaschera;

}

protected:
/// <summary>
/// Clean up any resources being used.
/// </summary>
~Class1()
{

}

// TODO: Add your methods for this class here.

//AGGIUNGO UN METODO PER INSERIRE

void inserire(void){

int i,j;

// CREO LA DATA MODIFICA

DateTime ora;
ora = DateTime::Now.ToUniversalTime();
modifica = ora.ToString("u");


rigaTabella = this->tableCassa->NewRow();

this->campiTabella =(array<String^>^) rigaTabella->ItemArray;

for(i=0;i<campiMaschera->LongLength;i++){

for(j=0;j<campiTabella->LongLength;j++){

if (campiTabella[i] == ::Convert::ToString("codice_punto_vendita")){
rigaTabella["data_modifica"] = modifica;
}else if(campiMaschera[j] == campiTabella[i]){
rigaTabella[i] = this->campiMaschera[i]->ToString();
}

}

}

this->tableCassa->Rows->Add(this->rigaTabella);
this->tabellaAdapter->Update(this->dataSetCassa);

}
Partecipa anche tu! Registrati!
Hai bisogno di aiuto ?
Perchè non ti registri subito?

Dopo esserti registrato potrai chiedere
aiuto sul nostro Forum oppure aiutare gli altri

Consulta le Stanze disponibili.

Registrati ora !
Copyright © dotNetHell.it 2002-2024
Running on Windows Server 2008 R2 Standard, SQL Server 2012 & ASP.NET 3.5