Advertisement

03.27.2008 at 11:39AM PDT, ID: 23275141
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

need explanation about "hard coded" programming in vb6 what are my classes and how they relate to my database?
Tags: microsoft, visual basic, 6, ms access 2003
i need to build a project that  is unbound-"hard coded" consists of the folowong forms:
1. a customers details form in which i can add, delete, change a customers details
2.an items form - with the same operations
3.Orders form- with the same operations
4. list of orders form
5.list of items form
6.list of Customers form
My 2 questions:
1.  i need to connect it to my data base(ms-access 2003)
 but *MUST*  do it  in a file which has all the information about the connection so ill use it *ONLY ONCE* to connect my project (again unbound controls etc.) how do i do this?
2.  regarding Classes and moduls: Which classes and modules should i create ? How should i attach them to the db for "add,del,edit " etc
urgent!!!!!
Start your free trial to view this solution
Question Stats
Zone: Programming
Question Asked By: LIMOR11
Solution Provided By: LSMConsulting
Participating Experts: 3
Solution Grade: A
Views: 0
Translate:
Loading Advertisement...
03.27.2008 at 11:45AM PDT, ID: 21224546

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.27.2008 at 12:08PM PDT, ID: 21224743

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.27.2008 at 12:15PM PDT, ID: 21224814

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.27.2008 at 12:20PM PDT, ID: 21224851

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.27.2008 at 01:47PM PDT, ID: 21225586

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.27.2008 at 02:35PM PDT, ID: 21225991

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.27.2008 at 05:13PM PDT, ID: 21226973

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.27.2008 at 08:03PM PDT, ID: 21227702

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.28.2008 at 02:37AM PDT, ID: 21228952

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.28.2008 at 04:53AM PDT, ID: 21229519

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.29.2008 at 05:19PM PDT, ID: 21238811

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Loading Advertisement...
Microsoft
  • Internet Protocols
  • Applications
  • Development
  • OS
  • Hardware
  • Windows Security
Apple
  • Operating Systems
  • Hardware
  • Programming
  • Networking
  • Software
Internet
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Spy / Ad Blockers
  • Web Browsers
  • New Net Users
  • Web Development
  • Chat / IM
  • Anti Spam
  • Web Servers
  • Anti-Virus
  • Email Clients
Gamers
  • Tips
  • Online / MMORPG
  • Puzzle
  • Emulators
  • Action / Adventure
  • Role Playing
  • Consoles
  • Game Programming
  • Strategy
  • Sports
  • Misc
  • Computer Games
Digital Living
  • Hardware
  • New Net Users
  • New Users
  • Software
  • Digital Music
  • Gaming World
  • Home Security
  • Apple
  • Networking Hardware
Virus & Spyware
  • Vulnerabilities
  • IDS
  • Encryption
  • Anti-Virus
  • Operating Systems Security
  • Software Firewalls
  • WebApplications
  • Cell Phones
  • Operating Systems
  • Internet
  • Hardware Firewalls
Hardware
  • Handhelds / PDAs
  • Displays / Monitors
  • Components
  • Networking Hardware
  • Peripherals
  • Laptops/Notebooks
  • Storage
  • Servers
  • Desktops
  • New Users
  • Misc
  • Apple
Software
  • System Utilities
  • Industry Specific
  • Network Management
  • Photos / Graphics
  • Page Layout
  • VMWare
  • Misc
  • Web Development
  • OS
  • CYGWIN
  • Voice Recognition
  • Message Queue
  • Quality Assurance
  • Security
  • Firewalls
  • MultiMedia Applications
  • Development
  • Database
  • Office / Productivity
  • Business Management
  • OS/2 Apps
  • Server Software
  • Internet / Email
ITPro
  • OS
  • Storage
  • Encryption
  • Operating Systems Security
  • Apple Hardware
  • Laptops & Notebooks
  • Servers
  • Networking Hardware
  • Peripherals
  • Devices
  • Displays / Monitors
  • WebTrends / Stats
  • Search Engines
  • Firewalls
  • WebApplications
  • IDS
  • Vulnerabilities
  • Email Clients
  • File Sharing
  • Spy / Ad Blockers
  • Web Browsers
  • Web Servers
  • Networking
  • Anti-Virus
  • Chat / IM
  • Anti Spam
Developer
  • Web Servers
  • Web Browsers
  • Game Programming
  • Dev Tools
  • Industry Specific
  • Office / Productivity
  • Database
  • CYGWIN
  • Web Development
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Programming
  • Content Management
  • Application Servers
  • Protocols
Storage
  • Removable Backup Media
  • Storage Technology
  • Servers
  • Grid
  • Remote Access
  • Backup / Restore
  • Misc
  • Hard Drives
OS
  • Miscellaneous
  • Security
  • Development
  • Linux
  • VMWare
  • MainFrame OS
  • Unix
  • Apple
  • OS / 2
  • AS / 400
  • BeOS
  • Microsoft
  • VMS / OpenVMS
Database
  • Oracle
  • Miscellaneous
  • MySQL
  • Software
  • Sybase
  • Contact Management
  • PostgreSQL
  • Data Manipulation
  • Clarion
  • InterSystems Cache
  • Siebel
  • MUMPS
  • OLAP
  • SQLBase
  • SAS
  • GIS & GPS
  • 4GL
  • Berkeley DB
  • DB2
  • Informix
  • Interbase / Firebird
  • FoxPro
  • Reporting
  • LDAP
  • Filemaker Pro
  • MS SQL Server
  • dBase
  • MS Access
Security
  • Misc
  • Web Browsers
  • Software Firewalls
  • Operating Systems Security
  • File Sharing
  • Spy / Ad Blockers
  • Vulnerabilities
  • WebApplications
  • IDS
  • Anti-Virus
  • Encryption
  • Anti Spam
  • Email Clients
  • VPN
  • Chat / IM
Programming
  • Editors IDEs
  • Installation
  • Handhelds / PDAs
  • Multimedia Programming
  • System / Kernel
  • Algorithms
  • Game
  • Signal Processing
  • Project Management
  • Open Source
  • Database
  • Misc
  • Languages
  • Processor Platforms
  • Theory
Web Development
  • Scripting
  • Blogs
  • Web Servers
  • Software
  • Search Engines
  • Web Graphics
  • Images
  • Internet Marketing
  • Images and Photos
  • Components
  • Document Imaging
  • Web Languages/Standards
  • Illustration
  • WebApplications
  • Fonts
  • WebTrends / Stats
  • Authoring
  • Digital Camera Software
  • Miscellaneous
Networking
  • Protocols
  • Apple Networking
  • Network Management
  • Message Queue
  • Application Servers
  • Content Management
  • File Servers
  • Email Servers
  • Misc
  • Java Editors & IDEs
  • Wireless
  • Networking Hardware
  • Backup / Restore
  • System Utilities
  • ISPs & Hosting
  • Web Servers
  • Storage Technology
  • Removable Backup Media
  • Servers
  • Broadband
  • Grid
  • OS / 2
  • Novell Netware
  • Unix Networking
  • Windows Networking
  • Security
  • Telecommunications
  • Operating Systems
  • Linux Networking
Other
  • Community Advisor
  • Lounge
  • Community Support
  • New Net Users
  • Philosophy / Religion
  • Math / Science
  • Miscellaneous
  • URLs
  • Expert Lounge
  • Politics
  • Puzzles / Riddles
Community Support
  • Suggestions
  • New to EE
  • New Topics
  • Community Advisor
  • CleanUp
  • Announcements
  • General
  • Feedback
  • Input
  • EE Bugs
 
03.27.2008 at 11:45AM PDT, ID: 21224546
>>i need to build a project that  is unbound-"hard coded"

What do you mean by this please?
 
03.27.2008 at 12:08PM PDT, ID: 21224743
that i can't use any bound controls such as ,adodc, datagrid etc.
it sould be in moduls ,classes and connect only once by using an extarnel file
i am new to vb how do i achieve this regarding what i wrote my project demends are.
 
03.27.2008 at 12:15PM PDT, ID: 21224814
Ah, I see - so you can't use OCXs - only the standard controls; yes?  And, for any standard control that supports binding - well, you can't use that either for some reason?

Can you use external DLLs - like can you add references, or are you limited to using the Windows' API alone?
 
03.27.2008 at 12:20PM PDT, ID: 21224851
i dont really know they didnt elaborate , but they did say my program should be on a server that a lot of users can connect and use it and portable
 
03.27.2008 at 01:47PM PDT, ID: 21225586

Rank: Genius

Homework?  Which class?
 
03.27.2008 at 02:35PM PDT, ID: 21225991
it isnt homework it is a job interview for a junior position in vb programming and data base they know i dont have any knoledge in it -that is why they gave me this assignmant to see how well i cope with it it should be submmited in a week !! i managed to do this project overthe  past few days but it was with bound controls (adodc) and they didnt accept this solution ! since they want my application to be
"hard coded" . i have a vague idea on how to write my procedures ' but don't know how to divide my project to classes , modules ,etc. asspacialy how to connect to my data base only once on a seperate file of which no matter where i am i could load the file and it will astablish a connection to my data base.

i thought of classes as: .1customers 2.Orders 3. items (based on the tabels ive build in my data base)
PLEASE HELP i need to start from somewhere but im cluless...
 
03.27.2008 at 05:13PM PDT, ID: 21226973

Rank: Genius

Wow ... that's a tall order ...

Generally classes should be based on an "entity" ... for example, in an Ordering system you'd have classes that would represent the Order, and that class would likely have a Collection of classes representing OrderLineItems. You'd also have a class representing the Customer/Client, perhaps a Shipping class, a Billing class, a Products class, an Inventory class ... in short, there is no cookie-cutter definition which defines the classes to use.

You can use a Connection class to handle only ONE connection (I've named this clsConnect):

[General Declarations]
Private mCON as ADODB.Connection
Private msDBpath As String

Property Let DBPath (sPath As STring)
  msDBPath = sPath
End Property

Property Get IsConnected() As Boolean
  IsConnected = (mCON.State = mCON.State AND adStateOpen)
End Property

Property Get MyConnection() As ADODB.Connection
  If Not IsConnected Then Connect
  Set MyConnection = mCON
End Property

Public Function Connect() As Boolean
  Connect = ConnectToDatabase()
End Function

Private Function ConnectToDatabase(Optional PathToDB As String) As Boolean
  If mCon Is Nothing Then Set mCon = New ADODB.Connection
  If Len(msDBPath)=0 and Len(PathToDB)=0 Then
    ConnectToDatabase = False
  Else
    If Len(PathToDB)>0 Then msDBPath = PathToDB
    mCon. Open "Your connectString here, which would include msDBPath"
  End If  

  If mCon.State = mCon.State AND adStateOpen Then
    ConnectToDatabase = True
  End If
End function

Sub Class_Initialize()
  Set mCon = New ADODB.Connection
  OpenConnection
End Sub

You'd use this class as such:

'/declare the below line i a Public Module's General Declarations sectin
Public gclsConnection As clsConnect

'/now set this when the app opens
Set gclsConnection = New clsConnect
gclsConnect.DBPath = "Fullpath to your database"
If gclsConnect.Connect Then
  Msgbox "Connection made"
End If

You would do this when opening your project ... you could then get to the connection like this:

Dim rst As ADODB.REcordset
Set rst = New ADODB.Recorset

If Not gclsConnect.IsConnected Then gclsConnect.Connect
rst.Open 'SELECT * FROM SomeTable", gclsConnection.MyConnection

====================

This needs a good bit of work - for example, connections can take a bit of time, so you'd probably need to include a Loop in the Connect method to give the app time to make the connection - but it's the bare basics of a connection class.
 
03.27.2008 at 08:03PM PDT, ID: 21227702
thank you for your replay it is much more clearer, although ive only just begun...
my question is: lets say that ive made a connection from my application to the database ( i guess that i have to put this connection class in a class module in my project, and whenever i need to make a connection i refer to it in my code? how do i do this?) when i use sql queries do i use "rst" in my code to reffer to my database  or do i have to put this linesDim rst As ADODB.REcordset
Set rst = New ADODB.Recorset at the beginning of every module//Class
 and BTW when do i use modules in my project?
- sorry if i didnt write my questions clear it is 5 am in the morning - and i havn't slept for almost 24 hours - i have to submit this project.
Dim rst As ADODB.REcordset
Set rst = New ADODB.Recorset
 
03.28.2008 at 02:37AM PDT, ID: 21228952

Rank: Genius

If you want to use a single class, then do as I suggested in my post: Declare a Public variable in a Standard Module:

Public gclsConnect As clsConnect

Now set this up in your setup routine (whether that's Sub_Main or a Form):

Set gclsConnect = New clsConnect
gclsConnect.DBPath = "Fullpath to your database"
If gclsConnect.Connect Then
  Msgbox "Connection made"
End If

From there, you'd use the Connection as need be ... the ADODB.Connection object (which you'd refer to as gclsConnection.MyConnection) would be the actual "connection" to your database. You'd use Recordsets to pull information from that database, so you'd do this:

Dim rst As ADODB.Recordset
Set rst = New ADODB.Recordset

rst.Open "SELECT * FROM MyTAble", gclsConnect.MyConnection

The major differences Standard Modules and Class Modules is that you can only ever have one "instance" of a Standard Module, while you can have xx number of instances of a single Class module. For example, if I have a Module name basCustomer, which stores all the information for a particular customer, then I can have only ONE customer loaded at a time ... this may not be a bad thing, but what if I need to load all the Orders for that customer? If have the code to do this in a Standard Module, I'd be able to work with only ONE Order at a time (since I can't instantiate more than one "instance" of that Standard Module). If I move the Order code to a Class Module, I can then have xx number of Orders:

Dim clsOrder1 As new clsOrder
Dim clsOrder2 As New clsOrder
Dim clsOrder3 As New clsOrder

Each of those objects above would have information about a different order, and I could refer to them independantly:

If clsOrder1.Price > clsOrder2.Price Then
  <do something here>
End If

In general: You'd have commonly used routines in an Standard Module, or routines that really don't belong in a Class module. For example, if you have a code routine that returns an OrderCount, then you might include that in a Standard Module since this would likely be needed outside of the Class object (actually, you'd probably prefer to build a Collection Class to include all the Orders for a particular Client, Date, etc, which would expose items such as Count - but that's another story entirely).

And I have to say, if you're not really even clear as to what a Recordset is vs a Connection, you probably should make this ABUNDANTLY clear to your interviewer ...
Accepted Solution
 
03.28.2008 at 04:53AM PDT, ID: 21229519
thank you for your replay:
in the connection class i have to use ADODB.Connection
(is the provider microsoft OLE DB for ODBC?)
he told me not to use ado or dao or anything alse that binds my data in a waythat  i can not have control over the connection (how long the connection lasts ,etc.) , so i guess i cannot use adodb (since it is ado) .so how can i make the proper connection regarding what ive been asked for ?
 
03.29.2008 at 05:19PM PDT, ID: 21238811
Okay managed to create a connection class and so far so good
thank you all for your answers.
 
 
20080236-EE-VQP-29 / EE_QW_2_20070628