473,385 Members | 1,343 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

ADO .NET equivalent of DAO codes

I have the following codes in VB which I need to convert to VB .NET 03.
It is the code for a command button click event in a form named frmLogin.

I have created a OleDbConnection Control, a OleDbDataAdapter Control and a
DataSet Control in my frmLogin(.net 03 version) to access another table
visually.
Do I need to create a new data connnection, data adapter, command object and
data set in codes in order to do what is done below or can I re-use the
controls somehow?

Can anybody help to convert the following codes to VB .Net 03? Thanks.

Private Sub cmdLogin_Click()
Dim UserMasterTb As Recordset

Set UserMasterTb = SYS_DB.OpenRecordset("User_Master", dbOpenTable)
With UserMasterTb
.Index = "PrimaryKey"
.Seek "=", Trim$(UCase(txtUserID.Text))
If Not .NoMatch Then 'userid found in database.
If Trim$(txtPassWd.Text) = Decrypt(![Usr_PassWd]) Then 'Password
correct.
CurrUserID_ = ![Usr_ID]
CurrUserLevel_ = ![Usr_Lvl]
End If
End If
End With

UserMasterTb.Close
Set UserMasterTb = Nothing
End Sub
Nov 20 '05 #1
1 1514
Cor
Hi Alice,

I was trying to make some changes but it would be rewriting the total part.
You are saying you are using a OleDBconnection Control, etc. I asume you
did use the wizards for it.

But you are using a recordset so that you have to skip.
Therefore I cannot see everything and make some little changes but it is not
all.
Private Sub cmdLogin_Click()
Dim UserMasterTb As Recordset

I think that you needs here something as
Oledbdatadapter1.fill(dataset11)
Then you can access the dataset and if it has a primary key you can use the
find instruction which is a member of "datarowcollections.find" if there is
not a key you can use the "datatable.select" or a for each loop through the
dataset.

It is a little bit confusing that all those methods are in different
classes, but now you know where.

And I think it is better not set things to nothing anymore.

close them if possible.

I hope this helps?

Cor

Nov 20 '05 #2

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

Similar topics

11
by: Maksim Kasimov | last post by:
in php-scripts, to insert data to database, i'm doing like this: ... $query_param = array( 'field0' => 1, 'field1' => 3, 'field2' => $var2, 'field3' => $var3, ); ...
18
by: Steve Litvack | last post by:
Hello, I have built an XMLDocument object instance and I get the following string when I examine the InnerXml property: <?xml version=\"1.0\"?><ROOT><UserData UserID=\"2282\"><Tag1...
3
by: c# beginner | last post by:
we are trying to standardize return codes across our .NET applications (that are soon to be developed.) What is the best practice for standardizing return codes? I know of only the following...
0
by: donnet | last post by:
To those familiar with Java beans, question on how to do with ASP.NET: I come from J2EE and starting to learn ASP.NET and C#. I want to find a way to display a web form filled with data taken...
0
by: Howard Kaikow | last post by:
If one has code that cannot include DoEvents, is it possible to achieve the equivalent of either of the following Excel VBA codes in VB .NET? Public Sub EnableInterrupt1() Const...
23
by: EOS | last post by:
Hi, As the title indicated, does anyone know the equivalent of GetTickCount() function in C/C++ for C#? The function is supposed to return time elapsed since the computer/device is booted in...
2
by: Diego Armando Maradona | last post by:
Hi, I am using toshiba tec sx8 thermal printer for printing our labels, in My old Delphi application I was using such code; ShellExecute(0,'open',Data.cmdbuffer, PChar('/c copy...
40
by: Campy Happer | last post by:
Hello all, I would like to bring to your attention a concept and a term for it that I think is long overdue. But first: In the bad old days of programming, before subroutines were even...
5
by: =?GB2312?B?17/HvyBaaHVvLCBRaWFuZw==?= | last post by:
Hi, I would like to have someone comments on what's the best practice defining error codes in C. Here's what I think: solution A: using enum pros: type safe. better for debug (some debugger...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...

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.