473,847 Members | 1,522 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Issue with DAO to ADO.Net

LDD
Hey folks

I'm porting an app from VB6 to VB.Net... what a process!

I'm about 70% of the way through.

However I'm trying to find some information on how to upgrade the code
snippet below to make use of ADO.Net

-----------------------------------------------------
....
Dim prsFiles As DAO.Recordset

prsFiles = frmMain.DefInst ance.getDatabas e.OpenRecordset ("tableName" ,
DAO.RecordsetTy peEnum.dbOpenDy naset)

End Select

prsFiles.AddNew ()

prsFiles.Fields ("FileName").Va lue = vsfilename

prsFiles.Update ()

prsFiles.Close( )

-----------------------------------------------------
The subroutine gets called from within a loop.

How do I modify the code to use ado.net/
Or if there is any clear documentation with samples, that would be cool to..

thanks

LDD

Nov 21 '05 #1
3 1679
LDD,

In my opinon the only answer can be in my opinion. Buy a book about ADONET.

Very known in these newsgroups are Sceppa and Vaughn as they are active in
these newsgroups.

microsoft.publi c.dotnet.framew ork.ADONET

Your question is to general and needs to much extra information for a
newsgroup message.

Sorry

Cor

"LDD" <la************ ***@gmail.com> schreef in bericht
news:7u******** ************@ma gma.ca...
Hey folks

I'm porting an app from VB6 to VB.Net... what a process!

I'm about 70% of the way through.

However I'm trying to find some information on how to upgrade the code
snippet below to make use of ADO.Net

-----------------------------------------------------
...
Dim prsFiles As DAO.Recordset

prsFiles = frmMain.DefInst ance.getDatabas e.OpenRecordset ("tableName" ,
DAO.RecordsetTy peEnum.dbOpenDy naset)

End Select

prsFiles.AddNew ()

prsFiles.Fields ("FileName").Va lue = vsfilename

prsFiles.Update ()

prsFiles.Close( )

-----------------------------------------------------
The subroutine gets called from within a loop.

How do I modify the code to use ado.net/
Or if there is any clear documentation with samples, that would be cool
to..

thanks

LDD

Nov 21 '05 #2
If you only have a very small amount of code to port and it doesn't use
databinding then you can use "classic" ADO from VB.NET - just add a
reference to ADODB.dll and start using the objects. You might also be
able to use DAO via COM interrop - but ADO is pretty similar in usage
to DAO.

If you have a large amount of this type of code to port and your
project uses a lot of databinding then you might want to consider
Infralution's Virtual Data Objects. This allows you to use classic
ADODB with ADO.NET databinding and can take a lot of the pain out of
porting a large application. You can download a fully functional
evaluation version at:

www.infralution.com/virtualdata.html

Grant Frisken
Infralution

Nov 21 '05 #3
Here's part of your conversion. This is an application that was in VB6 using
DAO which I've converted to VB.NET using ADO. The app uses the data from the
table to fill in a grid for viewing purposes.

Original DAO code:

Dim dbSteel As Database
Dim rsAK As DAO.Recordset
Set dbSteel = OpenDatabase("A KSteelEpstienVa lues.mdb")
Sql = "Select * from AKSteelData order by coil"
rsAK = dbSteel.OpenRec ordset(Sql, DAO.RecordsetTy peEnum.dbOpenDy naset)

Coverted ADO code:

Dim sql As String
Dim da As OleDbDataAdapte r
Dim con As OleDbConnection
Dim cmd As OleDbCommand
Dim Roll As DataSet
Me.MdiParent = CoreInfo.MDIFor m1.ActiveForm
Cursor.Current = Cursors.WaitCur sor
sql = "Select * from AKSteelData order by coil"
con = New OleDbConnection (OptAKCnn)
cmd = New OleDbCommand
da = New OleDbDataAdapte r
cmd.Connection = con
cmd.CommandText = sql
cmd.CommandType = CommandType.Tex t
con.Open()
Roll = New DataSet
da.SelectComman d = cmd
da.Fill(Roll, "AKSteelDat a")
DataGrid1.DataS ource = Roll.Tables("AK SteelData")
con.Close()
con.Dispose()
Cursor.Current = Cursors.Default


"LDD" wrote:
Hey folks

I'm porting an app from VB6 to VB.Net... what a process!

I'm about 70% of the way through.

However I'm trying to find some information on how to upgrade the code
snippet below to make use of ADO.Net

-----------------------------------------------------
....
Dim prsFiles As DAO.Recordset

prsFiles = frmMain.DefInst ance.getDatabas e.OpenRecordset ("tableName" ,
DAO.RecordsetTy peEnum.dbOpenDy naset)

End Select

prsFiles.AddNew ()

prsFiles.Fields ("FileName").Va lue = vsfilename

prsFiles.Update ()

prsFiles.Close( )

-----------------------------------------------------
The subroutine gets called from within a loop.

How do I modify the code to use ado.net/
Or if there is any clear documentation with samples, that would be cool to..

thanks

LDD

Nov 21 '05 #4

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

Similar topics

3
5232
by: Paul Mateer | last post by:
Hi, I have been running some queries against a table in a my database and have noted an odd (at least it seems odd to me) performance issue. The table has approximately 5 million rows and includes the following columns: DocID (INTEGER, PRIMARY KEY, CLUSTERED) IsRecord (INTEGER, NONCLUSTERED)
7
3307
by: George Hester | last post by:
Please take a look at this google artcle: http://groups.google.com/groups?hl=en&lr=&frame=right&th=55d6f4b50f5f9382&seekm=411f370d%241%40olaf.komtel.net#link9 The op was having trouble with access denied using resizeTo. I am having the same issue but the explanations in this article don't seem to apply here. I am not trying to resize a window with content from a different server. This issue lies here. What I do is make a popup...
2
2477
by: Anthony Cuttitta Jr. | last post by:
We have an application that outputs several different graphs from data downloaded from our AS400. The application has worked without (this) issue for several months now, but just recently, the workstation it is normally run from has been upgraded to WinXP from WinNT 5.0. The issue is that the graphs will either display the data within the recordsource (a query), OR it will display the "temp" data in the chart's datasheet (from initial...
0
3578
by: Kevin Spencer | last post by:
Hi all, I am working on a service that uploads METAR weather information to the National Weather Service FTP site. The service I'm authoring is hosted on a Windows 200 server, and the NWS FTP host is on a Unix server. I'm using the FtpWebRequest and FtpWebResponse classes to do the file uploading. I have tested it without any errors at all uploading to an IIS FTP server hosted on our network Most of the time it uploads without error to...
2
2827
by: Ben Rush | last post by:
Hello World, Okay, I have spent the day browsing the newsgroups and reading up on article after article concerning ViewState corruption and so forth, and I have a couple questions. We intermittantly get the following exception - EXCEPTION MESSAGE: The viewstate is invalid for this page and might be corrupted. STACK TRACE:
5
2532
by: Robert | last post by:
I have a series of web applications (configured as separate applications) on a server. There is a main application at the root and then several virtual directories that are independant applications. I am testing an upgrade of all of the sites and have converted the main root site...although not necessarily fixed any issues. I move on instead and converted one of the virtual roots that is a seperate
0
2232
by: Charles Leonard | last post by:
I am having yet another issue with Windows Server 2003. This time, the web service (a file import web service) appears to run except for one odd message: "ActiveX component can't create object". There are no other statements to indicate what object cannot be created. Otherwise, everything on the test Windows Server 2003 works fineā€”all import data updates correctly. Unfortunately, my normal development environment is not Windows...
4
3228
by: Paul | last post by:
Hi, I've been struggling with this today, I'm developing a DotNet2.0 website in C# that needs to call a long running data query. Obviously this is a good candidate for an Asynchronous call, so the page can carry on rendering whilst the call is taking place and also returning the ASP.NET worker thread to service another page request (for scalability). I have developed a very basic asynchronous object (for testing, that reproduces the same...
1
3276
by: AlekseyUS | last post by:
Hi, I'm a little stuck, I basically need to copy all the information within a specific file in Temp and append it to a file in another location. I'm not having any problems with smaller size log files stored within temp foldier and everything reads and appends perfectly, however when i try to read and append from IS12Install.log file in Temp all it appends to my destination file is: ˙ž= and a whole bunch of empty lines I believe...
13
3524
by: SAL | last post by:
Hello, I'm trying to include a popup in the ItemTemplate of a gridview row. The ItemTemplate for the field contains a textbox and when the user clicks in the textbox I want a popup panel to show allowing the user to make a selection from the popup window. I have enabled AJAX extensions and have a working sample outside of a gridview. However, when I click in the textbox of a gridview row, all I see is a really small square instead of the...
0
9892
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10996
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10718
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9497
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
7062
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5730
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5915
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4133
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3171
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.