How will I combine time and if in a data reader? I tried this, but in while DR1.Read it does not give me the whole result
while DR1.Read
if(DR1.Read()) { while(DR1.Read()) { flowLayoutPanel1.Controls.Add(label); } } else MessageBox.Show("No results found")
Try the following:
if (DR1.HasRows) { while (DR1.Read()) { flowLayoutPanel1.Controls.Add(label); } } else MessageBox.Show("No results found");
How about using bool?
Sort of
bool read = false; while (DR1.Read()) { read = true; } if (!read) MessageBox.Show("No results found");
Technically:
if(DR1.Read()) { do { flowLayoutPanel1.Controls.Add(label); } while(DR1.Read()) } else MessageBox.Show("No results found")
you can put this at the end because if(DR1.Read()) already loads the first line if present.
if(DR1.Read())
Source: https://habr.com/ru/post/1497553/More articles:Will the reactor provide remote access? - reactorCreating a Google chart using PHP and MySQL - jsonHow to get mysql data in google chart using php loop? - phpPython generators - float ((yield))? - pythonGCM Push messages are stored on the server until a new one appears - javaAJAX Call does not work, even if PHP and JS files work independently - javascriptChange input style with AJAX - jqueryDoes knockout.js really use the MVVM pattern? - mvvmLock object during json.Marshal in Go - jsonhttps://translate.googleusercontent.com/translate_c?depth=1&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1497558/do-pointers-to-classes-increase-modularity&usg=ALkJrhg0nurYZ1UdBEKSHLpHAMjp4CmcNwAll Articles