473,473 Members | 1,672 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Replacement for Recordset Bookmark?

In VB6/ADO I used to use the code below to put all the records that did not
have a valid email address into an array which I used later to print mailing
labels. I am not aware of a NET equivalent. What is the right way to
approach this in NET?

Wayne

==============================================
varSentToCount = 0 'Count of recipients

varBookmarkCount = 0 'Count or entries with no Email address

myRS2.MoveFirst()

Do Until myRS2.EOF

If InStr(myRS2!Email, "@") > 0 Then 'See if there is an Email address

arySendTo(varSentToCount) = Trim(myRS2!Email)

varSentToCount = varSentToCount + 1

Else ' No email addr

arytmp(varBookmarkCount) = myRS2.Bookmark

varBookmarkCount = varBookmarkCount + 1

If varBookmarkCount > 248 Then

MsgBox("Too many invalid email addresses to process!", vbOKOnly, "Too many
missing email addresses!")

GoTo ExitEmailSub

End If

End If

myRS2.MoveNext()

Loop
Nov 20 '05 #1
3 4790
Hi Wayne,

Are you using a recordset in VB.net or something else, when you use the
recordset than it is the same because the recordset is ADO, not really
dotNet.

The only thing is that your code looks a little bit classic, by not
declaring the value types and using goto ExitMailSub in stead of Exit Sub.
For the rest I would not see what needs to change when you are keep using
the recordset. (Where I advice to use the dataset).

I hope this helps?

Cor

==============================================
varSentToCount = 0 'Count of recipients
varBookmarkCount = 0 'Count or entries with no Email address
myRS2.MoveFirst()
Do Until myRS2.EOF
If InStr(myRS2!Email, "@") > 0 Then 'See if there is an Email address
arySendTo(varSentToCount) = Trim(myRS2!Email)
varSentToCount = varSentToCount + 1
Else ' No email addr
arytmp(varBookmarkCount) = myRS2.Bookmark
varBookmarkCount = varBookmarkCount + 1
If varBookmarkCount > 248 Then
MsgBox("Too many invalid email addresses to process!", vbOKOnly, "Too many
missing email addresses!")
GoTo ExitEmailSub
End If
End If
myRS2.MoveNext()
Loop

Nov 20 '05 #2
Thanks for the response. In VB.NET I use datasets so the bookmark is not
there.. Most of my declarations are at the head of the Sub - I didn't
include all the code in the post.

My code is less than optimal but the reason for the GoTo was that I have all
the code to close the recordset, set objects to nothing and such in that
area. Hopefully, my new VB.NET code will be better.

Wayne

"Cor Ligthert" <no**********@planet.nl> wrote in message
news:uX**************@TK2MSFTNGP12.phx.gbl...
Hi Wayne,

Are you using a recordset in VB.net or something else, when you use the
recordset than it is the same because the recordset is ADO, not really
dotNet.

The only thing is that your code looks a little bit classic, by not
declaring the value types and using goto ExitMailSub in stead of Exit Sub.
For the rest I would not see what needs to change when you are keep using
the recordset. (Where I advice to use the dataset).

I hope this helps?

Cor

==============================================
varSentToCount = 0 'Count of recipients
varBookmarkCount = 0 'Count or entries with no Email address
myRS2.MoveFirst()
Do Until myRS2.EOF
If InStr(myRS2!Email, "@") > 0 Then 'See if there is an Email address
arySendTo(varSentToCount) = Trim(myRS2!Email)
varSentToCount = varSentToCount + 1
Else ' No email addr
arytmp(varBookmarkCount) = myRS2.Bookmark
varBookmarkCount = varBookmarkCount + 1
If varBookmarkCount > 248 Then
MsgBox("Too many invalid email addresses to process!", vbOKOnly, "Too many missing email addresses!")
GoTo ExitEmailSub
End If
End If
myRS2.MoveNext()
Loop


Nov 20 '05 #3
Hi Wayne,

Looping through a dataset is even easier than through a recordset
\\\
for each dr as datarow in ds.tables(0).rows
if dr("myfield") = x then
'dosomething with the dr
next
///
or
\\\
for i as integer = 0 to ds.tables(0).rows.count-1
dim dr = ds.tables(0).row(i)
if dr("myfield") = x then
etc.
////

I hope this helps?
Cor
Nov 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Mad Hot dog | last post by:
Hello group! I use MS Visual C++ 6.0, ADO, MS SQL Server 2000. When I attempt to open my database I meet with a following problem: when I try to get a bookmark of the current record in a...
2
by: Harold | last post by:
Sat I have a customers table with the fields CustomerID and Customer and I use the recordset.addnew method to add a new record to the table. What is the best way to get the CustomerID of the new...
0
by: deko | last post by:
For some reason this is eluding me... I have a subform datasheet that contains appointments imported form Outlook. If the appointment is associated with an Entity in the database, it will have a...
8
by: cannen | last post by:
Hi all, Access Newbie here with I'm sure is an easily answered question. I have a form that has a tab control with a listbox called lstVacations. What iam attempting to do is click a record in...
2
by: corepaul | last post by:
I am fairly new to Access and I have a problem trying to use bookmarks with a recordset. I have a recordset dimensioned as, Dim rstFoodDesc As ADODB.Recordset ' recordset Dim bMark As...
5
by: Tom van Stiphout | last post by:
Hi all, I'm seeing a weird problem I'm thinking might be due to corruption. What do you think? Here is the relevant code, which is in a standard module, called from subfrmDetail's...
7
by: marmottedodue | last post by:
Hello, I'm trying to debug an access project in which two kind of recordset are used: ADODB.recordset and DAO.recordset. I'm trying to set the whole project on DAO.recordset, but the following...
3
ADezii
by: ADezii | last post by:
Last Tip, we demonstrated the technique for retrieving data from a DAO Recordset, and placing it into a 2-dimensional Array using the GetRows() Method. This week, we will cover the same exact Method...
1
by: nimeshjaiswal | last post by:
Hi, I m doing a migration project from VB6 to VB.NET 2008. I m facing problem in migration the recordsets to dataset specially with properties in fields and bookmark with recordset. ...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.