Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Teach and old Dog new Tricks (Old dumb dog at that)

Posted on 2004-09-13
9
Medium Priority
?
249 Views
Last Modified: 2010-05-02
I have a program that I wrote in vb5 several years ago. It usess an access 97 db and several instances of the datacontrol with bound controlls like datagrids and others.

I would like to convert it to VB6 or even better VB 2005 express, do away with the datacontrols, upgrade to possibly access 2003.

Easy points for the best referance for accomplishing this.  Very detailed explanation with examples would be great, especially on doing away with the datacontrols.

Thanks!
0
Comment
Question by:Gary Dewrell
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
  • 2
  • +1
9 Comments
 
LVL 2

Expert Comment

by:x50Fade
ID: 12051748
You will need to use ADO to manually connect to your db if you don't want the data controls.

It's quite simple.....

Next about your code...your VB5 code should work nicely in VB6, as VB6 only offers enhancements to VB5, it still uses all the stuff we did in VB5 and just add's to it.

About the DB...Get Newes access, open your old DB, and convert it to the new access format.

This should get you started....

Maybe you could post some more deatiled questions?
0
 
LVL 26

Expert Comment

by:Rejojohny
ID: 12053350
just curious ... what is "VB 2005 express"
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 2

Expert Comment

by:x50Fade
ID: 12053550
Hmmmm....Looks like it's the new VB.NET (Maybe Whidby) "Light Edition"

http://lab.msdn.microsoft.com/express/vbasic/default.aspx
0
 
LVL 12

Author Comment

by:Gary Dewrell
ID: 12060231
That is correct x50! It is a lite version of vb.net.  They also have a sql express, c# express, etc. It is mainly for those who just want to do winforms.

Back to my issue.  Could some one take a moment to explain how to use ADO.

I have several forms accessing several tables from my database.
Im just looking for sorta guide to get started.

Some forms are accessin several tables at the same time. So a quick explanation (not real detailed, I want to figure that out myself, but I need a push) of how to use ado to connect to the database, execute querys that update records, retrieve data for use in datagrids, etc..  

One specific question I have is do I have to write the same code over and over again on each form?
0
 
LVL 2

Accepted Solution

by:
x50Fade earned 2000 total points
ID: 12061679
HI Old dog....hehe

K, I can help ya out with ADO, but not ADO.net. VB6 uses ADO and VB.net uses ADO or ADO.NET.

To connect to a DB through ADO, you need mainly two objects.

A Connection Object (Connection to the DB)
A Recordset Object (Used for running queries on tables and retreiving data)

On your last question....The connection you only build once, You can put the data Access Code (Recordset Stuff) in a Module, and use it over and over.

A quick example

Private Sub MDIForm_Load()
    Set dbAse = New Connection
        dbAse.CursorLocation = adUseServer
        dbAse.Open "PROVIDER=MSDataShape;Data PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\systems.mdb"
       
End Sub

In the Module, where RS is defined as a Public Variable

Public Function Open_Recordset(FieldstToOpen As String, TableToOpen As String)

   On Error GoTo Open_Recordset_Error

rs.Open "Select " & FieldstToOpen & " from " & TableToOpen, dbAse, adOpenKeyset, adLockOptimistic

   On Error GoTo 0
   Exit Function

Open_Recordset_Error:

    MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure Open_Recordset of Module General" & vbCrLf & vbCrLf & TableToOpen
End Function

Once the recordset is open, you can iterate through it like this...

While not rs.eof
 msgbox rs.fields("Fieldname")
 rs.movenext
Wend

Actually a lot more to it...but this should get you started...
0
 
LVL 2

Expert Comment

by:x50Fade
ID: 12061683
Oh yes and you have to set the propper references in your project....look for Microsoft ActiveX Data Objects and add it as a reference.

Cheers

Fade
0
 
LVL 14

Expert Comment

by:Esopo
ID: 12066259
A thorough explanation on why to take the leap (ADO to ADO.NET) and how to go about it:

Migrating Code and Concepts from ADO "Classic" to ADO.NET

http://msdn.microsoft.com/data/default.aspx?pull=/library/en-us/dnadonet/html/adocnet4.asp

Best regards,

Esopo
0
 
LVL 12

Author Comment

by:Gary Dewrell
ID: 12070288
Thanks guys, I will look trough all of these within the next 24-28 hours and award appoints.
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question