While loop...
-
This is a disaster - why do you have four readers ?
Christian Graus - C++ MVP
-
i use 4 reader because i need to read 4 rows from the same table and i dun know any other shorter way out. Any suggestion in how i should do it?
Wow. Take a step back and do some reading. If they are all in the same table, then you only need one reader, each row will contain all the values you need, assuming you select them.
Christian Graus - C++ MVP
-
What kind of objects are you using? How are the objects related? It looks kind of like you are reading from four tables simultaneously. Why would you do that? Can't you combine them into one result when you query the database?
--- b { font-weight: normal; }
-
What kind of objects are you using? How are the objects related? It looks kind of like you are reading from four tables simultaneously. Why would you do that? Can't you combine them into one result when you query the database?
--- b { font-weight: normal; }
He's using four readers as he needs four columns from one table. I suspect that's the core issue.
Christian Graus - C++ MVP
-
i dun understand ur question. Ya, i need to read 4 diff rows from the same table therefore i use 4 reader. I do not know any shorter way to combine in one result. Any suggestion on tis error u can provide me with??
Subjugate wrote:
Ya, i need to read 4 diff rows from the same table therefore i use 4 reader
You need four rows, or four columns ? If you need four rows, then you need to do a select that requests those four. If you need four columns, your select statement should request those four.
Christian Graus - C++ MVP
-
Wow. Take a step back and do some reading. If they are all in the same table, then you only need one reader, each row will contain all the values you need, assuming you select them.
Christian Graus - C++ MVP
-
He's using four readers as he needs four columns from one table. I suspect that's the core issue.
Christian Graus - C++ MVP
-
DO u have any site where by i am able to read the information i like. I am quite a noob to coding. Or do u have any sample code on that?
You're on a site full of articles. But, if you're really that new, then you really need to take a step back, and work through a book or two. http://msdn.microsoft.com [^] is full of info as well, but this [^]is the best way to search it, use site:msdn.microsoft.com in your search string.
Christian Graus - C++ MVP
-
Ya.. sori for my explanation error i need 4 columns from the same table. U mean i just need to use the SELECT sql to retrieve my 4 columns?
Yes, if you do a Select *, then all four columns will be read. dTable3.Rows(0)("Frequency") is reading the Frequency column, that's how you specify any column on the one reader.
Christian Graus - C++ MVP
-
Yes, if you do a Select *, then all four columns will be read. dTable3.Rows(0)("Frequency") is reading the Frequency column, that's how you specify any column on the one reader.
Christian Graus - C++ MVP
-
i have a serious problem with my loop. My loop can only read the 1st data in my database even though there is 2 data inside. I think the problem should lays on my loop. Can u guys take a look at my loop and try to help me troubleshoot. Thanks a lot cos tis is urgent i got to pass up my proj soon. While TReader.Read And TReader2.Read And TReader3.Read And TReader4.Read strActionName = dTable.Rows(0)("ActionName") strStatus = dTable2.Rows(0)("Status") strFrequency = dTable3.Rows(0)("Frequency") strActionDone = dTable4.Rows(0)("ActionDone") strOneLine = ("ActionName = " + strActionName + "," + " Task = " + strActionDone + "," + " Frequency = " + strFrequency + "," + " Current Status = " + strStatus + "") MessageBox.Show(strOneLine) End While
assuming you've a data control data1.refresh data1.recordsource = "select * from yourdb" data1.recordset.movefirst do while not data1.recordset.eof strFirstField = data1.recordset.fields("Field1").value strSecondField = data1.recordset.fields("Field2").value data1.recordset.movenext loop