|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
I have done a few applications using databases, so I am familiar with using them...however, I recently installed visual basic at a new computer, and now when I try to create a database object the weirdest thing happens...
When you create a new variable, Visual Basic brings up a list of recognized data types....but when I do: Dim db as Database Database is not a recognized data type...ie, it's not in the popup list of data types. Just to try, I left the statement above as you see it now. I tried running the program, only to get this error: Compile Error: User-defined type not defined What do I need to do in order to get visual basic to recognize the database type (as well as the recordset type)?
__________________
~~Macrado~~ |
|
#2
|
||||
|
||||
|
Re: Database Object Not Defined???
well, in VB, you use several objects to access database tables/stored procedures, and the like. The central object is obviously the recordset, as it holds the data. The recordset also has several properties and methods that allow for different variations, such as SQL Statements, Dynamic recordsets, lock types, and the like. To actually get to the database, however, you must have a Connection object, which is defined in the ADODB library. You declare it as
Code:
dim cnConnection as new ADODB.Connection The connection object is VB's way of keeping the source of the data and the actual data disconnected to create a more object-oriented design for ADODB. You must include a project reference to the ADODB library in Project->references in the menus at the top of the VB IDE.
__________________
Fisherman "Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius -- and a lot of courage -- to move in the opposite direction." - A.Einstein |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > Visual Basic Programming > Database Object Not Defined??? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|