Re: adodb
- From: "Pinto1uk" <Pinto1uk@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 22 Dec 2005 08:49:09 -0800
thanks for all your help. i really appreaciate it.
regards
"Branden Johnson" wrote:
> Most of the answers provided are available in your VB Help.
>
> > and what is ADODB?
> Microsoft ADO (ActiveX Data Objects) is a Component object model object for
> accessing data sources. It provides a layer between programming languages
> and databases, which allows a developer to write programs which access data,
> without knowing how the database is implemented. No knowledge of SQL is
> required to access a database when using ADO, although one can use ADO to
> execute arbitrary SQL commands. The disadvantage of this is that this
> introduces a dependency upon the database.
> en.wikipedia.org/wiki/ADO
>
>
> >also, why does this peice of code insist on me
> > providing a startup object?
> Not sure... You should have a startup object. You can use either a Form or a
> "Sub Main()" procedure. You would use a Form if you want the user of the
> program to enter directly into a Menu, for example. You would use a Sub
> Main() to set values of certain variables, controls, etc... prior to opening
> a Form. If you use the Sub Main() you will need to open a Form through code
> inside the Sub in order for the user to ever see anything.
>
> > Dim adoConnection As ADODB.Connection
> A Connection object represents a unique session with a data source. In the
> case of a client/server database system, it may be equivalent to an actual
> network Connection to the server. Depending on the functionality supported
> by the provider, some collections, methods, or properties of a Connection
> object may not be available.
>
> You establish the Connection object to "Connect" to the database (i.e. Your
> Modem would be your connection object to dial-up to your ISP).
>
> > Dim adoRecordset As ADODB.Recordset
> A Recordset object represents the entire set of records from a base table
> or the results of an executed command. At any time, the Recordset object
> refers to only a single record within the set as the current record.
>
> > Dim connectString As String
> This is a variable declaration. The variable name is "connectString". A
> String variable is used to hold a group of alphanumeric characters.
> Generally names, codes, etc...
>
> > Set adoConnection = New ADODB.Connection
> Here you are allocating the "adoConnection" object for a New connection to
> the database.
> Example: Here you are telling your Modem to connect to the Verizon Server
>
> > Set adoRecordset = New ADODB.Recordset
> Same thing here except this is a Recordset.
>
> > connectString = "Provider=Microsoft.Jet.OLEDB.4.0;" _
> > & "Data Source=C:\Documents and Settings\Iqbal\My
> > Documents\IQBAL\test.mdb"
> The connection string is telling the program what you are connecting to,
> where the database is, and what options you want to use for the connection.
> In the above line you are connecting to Microsoft Access and your database
> is located in the IQBAL folder in your My Documents.
>
> > adoConnection.Open connectString
> This is telling the program to connect now, using the connection string
> provided. (i.e. Clicking the "Dial" button on your connection to your ISP.
>
> > adoRecordset.Open "Table1", adoConnection
> This is setting your Recordset to all the data in your "Table1" table using
> the open connection to the database "adoConnection".
>
> > Do Until adoRecordset.EOF
> >
> > List1.AddItem adoRecordset!UserName
> > adoRecordset.MoveNext
> > Loop
>
> The above code snippet is a Do Until...Loop (similar to a For...Next Loop).
> This will iterate through all the records in your recordset. Each one that
> it finds it is adding the UserName fields data to a ListBox, "List1". The
> EOF is End of File. This tells the the Loop that you are at the end of the
> Recordset's data collection. The MoveNext method tells the loop to move to
> the next record in the Recordset at each iteration of the loop.
>
> > adoRecordset.Close
> > adoConnection.Close
> The above lines are closing the Recordset and Connection to the Database.
> (i.e. Disconnecting from your ISP to go offline.) NOTE: The data that you
> retrieved from the Database will still be loaded into your ListBox.
>
> > Set adoRecordset = Nothing
> > Set adoConnection = Nothing
> Here you are deallocating the Recordset and Connection objects. (i.e.
> Freeing up your RAM)
>
> Here is a Tutorial download for ADO:
> http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=12050&ln
> gWId=1
>
> Hope this helps...
>
> Branden Johnson
>
>
>
.
- References:
- Re: adodb
- From: Branden Johnson
- Re: adodb
- Prev by Date: Re: adodb
- Next by Date: Re: Detaching and Attaching DBs
- Previous by thread: Re: adodb
- Next by thread: Re: Detaching and Attaching DBs
- Index(es):
Relevant Pages
|