Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Selecting data from a DataBase Table and a Memory DataTable
Message
De
16/12/2007 06:06:38
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
Bases de données
Titre:
Selecting data from a DataBase Table and a Memory DataTable
Divers
Thread ID:
01276146
Message ID:
01276146
Vues:
65
Hello all,

Does anyone know how to select data from a DataBase table using rows from a memory DataTable as a reference?

What i mean is something like:
DataTable MemoryDataTable = new DataTable("Table");
MemoryDataTable.Columns.Add("id", typeof(string));

DataRow MemoryDataTableRow = MemoryDataTable.NewRow();
MemoryDataTableRow["id"] = "1234";
MemoryDataTable.Rows.Add(MemoryDataTableRow);
MemoryDataTableRow["id"] = "1235";
MemoryDataTable.Rows.Add(MemoryDataTableRow);
then i would create a select statement to get data from a DataBase table using the rows from the memory Datatable, something like;
string select = "select a.id, a.name from Names a, (MemoryDataTable) b where a.id = b.id";
The above code, or something similar, it's possible?

I need this because the alternative is to create a select statement where i would, explicitly, put all the id's.
Something like:
string select = "select a.id, a.name from Names a where a.id = '1234' or a.id = '1235'";
With this 2 id's it's not difficult, but it can go to hundreds...

TIA,
Joaquim
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform