14-10-12, 09:37 PM
- مثال شامل : معرفة كل الجداول في قاعدة البيانات DataSet ومعرفة الصفوف والأعمدة :
C#:
vb.net:
C#:
كود :
[SIZE=3]Text1.Text="";
foreach (DataTable dt in empDataSet.Tables)
{
Text1.Text+=dt.TableName + ":\n\r";[/SIZE]
[SIZE=3]for (int curCol = 0; curCol < dt.Columns.Count; curCol++)
{
Text1.Text+= (curCol+1).ToString() + dt.Columns[curCol].ColumnName+"\n\r";
}[/SIZE]
[SIZE=3]Text1.Text="Rows: \n\r";
for (int curRow = 0; curRow < dt.Rows.Count; curRow++)
{
for (int curCol = 0; curCol < dt.Columns.Count; curCol++)
{
Text1.Text+= dt.Rows[curRow][curCol].ToString() + " - ";
}
}
}[/SIZE]vb.net:
كود :
Text1.Text="";
foreach (DataTable dt in empDataSet.Tables)
{
Text1.Text+=dt.TableName + ":\n\r";
for (int curCol = 0; curCol < dt.Columns.Count; curCol++)
{
Text1.Text+= (curCol+1).ToString() + dt.Columns[curCol].ColumnName+"\n\r";
}
Text1.Text="Rows: \n\r";
for (int curRow = 0; curRow < dt.Rows.Count; curRow++)
{
for (int curCol = 0; curCol < dt.Columns.Count; curCol++)
{
Text1.Text+= dt.Rows[curRow][curCol].ToString() + " - ";
}
}
}