please help me to combine label id, text and database content first, i got 3 data in my database (tabel name: "mydata", content: data001, data002, data003) << [succeed] then, in my Asp.net webpage, i put 3 Label (ID: out1, out2, out3) << [succeed] in my .cs file, i insert connect the database, then the myquery(select * from mydata) << [succeed] SqlDataReader reader = myquery.ExecuteReader(); << [succeed] while(reader.Read()) { for(int a=0;a<4;a++) { "out" + a.ToString() + ".Text" = (string)reader["mydata"]; << [FAILED] error message: "The left-hand side of an assignment must be a variable, property or indexer" i wanna automated the label id (out1,out2,out3) increment using loop int a, then the text also automated, and a the webpage, Label named out1, out2, out3, the text will change into data001, data002, data003. } }
Thx, it work... now my label can be automated... but, there's lil' problem... when i use = (string)reader["mydata"]; << the record shown just the last record from the database then i using array to collect each database data... with hope that they will be like this... out1.Text = first database data out2.Text = second database data etc... but still... all Label.Text shown only the last database data... where i did wrong? thx b4... ^ ^