Recordset in VB6, and what is the equivalent in VB.Net?
Posted on 2004-10-18
I used to use recordsets a lot in VB6. Now I wish to know if there's any way to code in VB.Net using SQLDataReader/SQLDataAdapter/DataSet to perform likke recordsets (especially opening a few recordsets to perform certain tasks)?
I have table_a, table_b, table_c, table_d
table_a is the mail table whilst the rest are the reference tables.
table_a = transactions (custno, userno, transtime, billno, charges)
table_b = seqnotable (fileno, curr, skip, prefix)
table_c = billss (billno, custno, totalcharges)
table_d = qlist (custno, billno, posted)
do while not (bof(qlist) or eof(qlist))
if qlist.billno = '' or qlist is null then
newbillno = createbill(custno)
newbillno = qlist.billno
update transactions.billno with newbillno for each userno under that custno
totalcharges = calculate total charges in transaction for that newBillno
update bills.totalcharges with totalcharges for that billno
update qlist.posted = 'Y' for that custno + billno
update qlist.billno = 'NIL' for that custno
move to next record in qlist
function anytransaction(byval custno) as boolean
select count(*) in transaction for that custno
if results <= 0 records
anytransaction = False
anytransaction = true
function createbill(byval custno) as string
look for the fileno = 'bill' in seqnotable,
get the seqnotable.curr
newBillNo = prefix + cstr(seqnotale.curr)
update seqnotable set curr= curr + skip for this fileno = 'bill'
createbill = newNillNo
Basically this is the frame of the program. Since there are reference tables and main table and a lot of updates here and there in the tables, I use recordser to represent each of the table whenever they are needed. VB6 allows opening of a number of recordsets at the same time with the conditions that they are of different names.
No I have to rewrite the same program in VB.Net, I am not sure how should I begin with it. I tried DataSet but I have some problems when doing the updates to the actual database. The update commands seems to give me some problems when I use CommandBuilder.
I use System.Data.SQLClient because I connect to SQL Server as database.
Someone there please help me.. Thank you!