Results 1 to 3 of 3

Thread: File-less Database

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jul 2003
    Location
    Canada
    Posts
    135

    Question File-less Database

    Im hoping someone can help me out here.
    I am looking to create a virtual type database that is created on runtime and is destroyed when the program ends.

    After looking at my program I figure this would be the best way to handle the data rather then trying to play around with a bunch of arrays and "if then"s.

    I have done it before with VBScript in ASP but cannot find any articles for VB6 in regards to this.

    If anyone can help me out it would be great.

    Incase you dont know what Im talking about, this is a snip of what I was doing in ASP:

    Code:
    <object runat="Server" scope="Application" id="rstActiveUsers" progid="ADODB.Recordset">
    </object>
    	Const adInteger = 3
    	Const adVarChar = 200
    	Const adDate = 7
    	rstActiveUsers.Fields.Append "id", 3
    	rstActiveUsers.Fields.Append "nickname", adVarChar, 25
    	rstActiveUsers.Fields.Append "area", adVarChar, 75

  2. #2
    Frenzied Member dis1411's Avatar
    Join Date
    Mar 2001
    Posts
    1,048
    u could make your own type

    VB Code:
    1. Type EmployeeRecord   ' Create user-defined type.
    2.    ID As Integer   ' Define elements of data type.
    3.    Name As String * 20
    4.    Address As String * 30
    5.    Phone As Long
    6.    HireDate As Date
    7. End Type
    8.  
    9. Dim MyRecord As EmployeeRecord   ' Declare variable
    10.  
    11. Private Sub Command1_Click()
    12.     MyRecord.ID = 12003   ' Assign a value to an element.
    13.     MsgBox MyRecord.ID
    14. End Suc

  3. #3
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758
    There is very little difference between your asp code and the vb code. Depending on your needs, you may need to increase the scope of the variables used below. They are private to a form.


    VB Code:
    1. Option Explicit
    2.  
    3. Private Const adInteger = 3
    4. Private Const adVarChar = 200
    5. Private Const adDate = 7
    6.    
    7. Private rstActiveUsers As ADODB.Recordset
    8.  
    9. Private Sub Form_Load()
    10.   Set rstActiveUsers = New ADODB.Recordset
    11.  
    12.   rstActiveUsers.Fields.Append "id", adinteger
    13.   rstActiveUsers.Fields.Append "nickname", adVarChar, 25
    14.   rstActiveUsers.Fields.Append "area", adVarChar, 75
    15.   rstActiveUsers.Open
    16. End Sub
    Last edited by brucevde; Sep 8th, 2003 at 01:01 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width