Probiers mal mit ner ArrayList, schneller noch mit 'ner
System.Collections.Specialized.StringCollection

Gruss Silvan


-----Urspr�ngliche Nachricht-----
Von: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]Im Auftrag von Robert
Walther
Gesendet: Mittwoch, 3. Juli 2002 18:25
An: aspDEdotnet
Betreff: [aspdedotnet] feld von strings


hi,
ich lese aus einer tabelle im dataset die spaltennamen und
m�chte sie gern in ein stringarray speichern.
etwa so:

string[] colnamen;

private void Page_Load()
{
   DataColumnCollection cols;
   cols = dataSet11.Tables[this.tabname].Columns;
   int index=0;
   foreach(DataColumn col in cols)
   {
        this.colnamen[index]=col.ColumnName;
        index++;
   }
}

das geht aber nicht wegen:
   "Object reference not set to an instance of an object."
wenn ich statt
    string[] colnamen;    string[] colnamen={};
schreibe,kommt:
   "Index was outside the bounds of the array."

wie geht'n das richtig???
mfg rob

| [aspdedotnet] als [EMAIL PROTECTED] subscribed
| http://www.dotnetgerman.com/archiv/aspdedotnet/ = Listenarchiv
| Sie k�nnen sich unter folgender URL an- und abmelden:
| http://www.dotnetgerman.com/listen/aspDEdotnet.asp



_________________________________________________________

Do You Yahoo!?

Get your free @yahoo.com address at http://mail.yahoo.com




| [aspdedotnet] als [email protected] subscribed
| http://www.dotnetgerman.com/archiv/aspdedotnet/ = Listenarchiv
| Sie k�nnen sich unter folgender URL an- und abmelden:
| http://www.dotnetgerman.com/listen/aspDEdotnet.asp

Antwort per Email an