Results 1 to 17 of 17

Thread: Simple Database revisited

  1. #1

    Thread Starter
    PowerPoster cafeenman's Avatar
    Join Date
    Mar 2002
    Location
    Florida
    Posts
    2,819

    Simple Database revisited

    I have made some modifications to the code I posted last night. I got some real good feedback from Martin Liss and Bruce Fox whom I want to thank.

    I just used the app to create two completely new apps in under 30 minutes. In that time I also added code to read quotes from an Access database into a data file. The Access database was almost 0.5 MB. The quote file is 143 KB. Major size difference.

    Anyway, I would really appreciate feedback from someone who uses it.

    I am uploading three versions of it. In this post is the master from which you can make whatever you want.

    The next post will have the Quote Creator utility. It is used for the developer to create a Quote of the Day data file and has the database functionality.

    My third post will be the applet which is stripped of all editing functionality as it would be included in another app. In other words, the user can scroll through the quotes, but they can't edit them.

    Instructions are in the ReadMe file in the zip file attached to this post.

    PLEASE PLEASE PLEASE.... I need feedback from you as to what problems you had implementing this. Somebody try to make an address book or something and let me know what problems you run into. You should be able to take this app and have a fully functional address book in less than an hour. It's really that simple.

    NOTE: DO NOT unzip files from these three zips into the same folder. Many files have the same name, but have been modified so overwriting files will be bad.
    Attached Files Attached Files
    Last edited by cafeenman; May 28th, 2002 at 10:19 PM.

  2. #2

    Thread Starter
    PowerPoster cafeenman's Avatar
    Join Date
    Mar 2002
    Location
    Florida
    Posts
    2,819
    This post has the Quote Creator utility. It does not include the quote file because it made the zip file too big. The quote file is in the next post.
    Attached Files Attached Files

  3. #3

    Thread Starter
    PowerPoster cafeenman's Avatar
    Join Date
    Mar 2002
    Location
    Florida
    Posts
    2,819
    This post has the applet you would include in a larger application. It also includes the quote file.
    Attached Files Attached Files

  4. #4
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428
    when you click on the "-" sign under the "Double Array" list box, if nothing is selected you will get a runtime error. And it would be nice to ask the user to see if they REALLY REALLY want to delete the entery

    ANOTHER IMPORTANT THING I ALWAYS NOTICE!!!!
    all the people use the isNumeric function, I say dont use it!! NEVER!!!
    do this:

    from Programming Microsoft Visual Basic 6
    You should be aware that this function isn't robust enough for most real-world applications. For example, the IsNumeric function incorrectly considers these strings as valid numbers:

    123,,,123
    345-
    $1234 ' What if it isn't a currency field?
    2.4E10 ' What if I don't want to support scientific notation?

    here's the code you can use to be 100% sure that the user enters a number:
    VB Code:
    1. Function CheckNumeric(text As String, DecValue As Boolean) As Boolean
    2.     Dim i As Integer
    3.     For i = 1 To Len(text)
    4.         Select Case Mid$(text, i, 1)
    5.             Case "0" To "9"
    6.             Case "-", "+"
    7.                 ' Minus/plus signs are only allowed as leading chars.
    8.                 If i > 1 Then Exit Function
    9.             Case "."
    10.                 ' Exit if decimal values not allowed.
    11.                 If Not DecValue Then Exit Function
    12.                 ' Only one decimal separator is allowed.
    13.                 If InStr(text, ".") < i Then Exit Function
    14.             Case Else
    15.                 ' Reject all other characters.
    16.                 Exit Function
    17.         End Select
    18.     Next
    19.     CheckNumeric = True
    20. End Function
    that function is from the same book btw


    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  5. #5

    Thread Starter
    PowerPoster cafeenman's Avatar
    Join Date
    Mar 2002
    Location
    Florida
    Posts
    2,819
    That code looks pretty good to me. But it looks like it will allow more than one decimal. I'll have to try it and see what happens. It may need a counter added to prevent more than one decimal in the string. Thanks for the feedback.

  6. #6
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428
    Originally posted by cafeenman
    That code looks pretty good to me. But it looks like it will allow more than one decimal. I'll have to try it and see what happens. It may need a counter added to prevent more than one decimal in the string. Thanks for the feedback.
    actually I think it works correctly. otherwise you have to blame the author Francesco Balena for it
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  7. #7

    Thread Starter
    PowerPoster cafeenman's Avatar
    Join Date
    Mar 2002
    Location
    Florida
    Posts
    2,819
    OK, I'm not saying it doesn't work. I just don't see where it only allows one decimal. But it doesn't matter how it looks to me since I haven't tried it yet. If you say it works, I believe you.

    I'm trying to add a Find function to the cTable class. That involves parsing again which I suck at. Anyone who would like to give me a hand writing the code for parsing strings like:

    ID = 1
    ID <> 1
    ID >= 1

    etc, I would be most appreciative. I don't plan to include Like functionality. Just <, > and =

    Thanks.

  8. #8
    INXSIVE Bruce Fox's Avatar
    Join Date
    Sep 2001
    Location
    Melbourne, Australia
    Posts
    7,429
    I noticed that when I had added a few records, and deleted one
    of them, the (deleted Records) "String" remained behind in the
    dropdown combo in the ToolBar.


    Bruce.

  9. #9

    Thread Starter
    PowerPoster cafeenman's Avatar
    Join Date
    Mar 2002
    Location
    Florida
    Posts
    2,819
    Originally posted by Bruce Fox
    I noticed that when I had added a few records, and deleted one
    of them, the (deleted Records) "String" remained behind in the
    dropdown combo in the ToolBar.
    Bruce.
    Thanks Bruce. Here's the fix:
    VB Code:
    1. Dim iReturn As Long
    2.  
    3. iReturn = MsgBox("Are you sure you want to delete this record?", vbYesNo + vbQuestion, APP_TITLE)
    4. If iReturn = vbNo Then Exit Sub
    5.  
    6. Reposition DELETE_RECORD
    7.  
    8. ' Add the next two lines of code to take care of the combobox problem
    9. TBL.PopulateCombo cmbField
    10.  
    11. SetMenus
    12.  
    13. Changed = False
    What I really want to know about is can you use this code to create data files for your projects easily by just dropping it in and making modifications to the field names. That's the intent of this code.

    The interface I created was rough and dirty and not really what I'm looking for feedback on. I hope I don't sound ungrateful, because I do appreciate the feedback I'm getting. But what I'm not getting is the feedback that I really want.

    What I'd like to see is someone take my code and use it to create their own data file with different fields than supplied.

    Thanks for all your help though. I really do appreciate it.

  10. #10

    Thread Starter
    PowerPoster cafeenman's Avatar
    Join Date
    Mar 2002
    Location
    Florida
    Posts
    2,819
    Mr Polite, that function is awesome. It does indeed allow only one decimal. Thanks for sharing it. I will use it often.

  11. #11
    Fanatic Member MikkyThomeon's Avatar
    Join Date
    Oct 2002
    Location
    At work...
    Posts
    648
    A few problems...

    Could not dl the quote file from this site - winzip reported errors...
    What is the filename of the library :Microsoft Connection Designer Instance? This is not referenced on my machine...

    Thanks
    Mike

  12. #12
    Fanatic Member MikkyThomeon's Avatar
    Join Date
    Oct 2002
    Location
    At work...
    Posts
    648
    Hey cafeenman - I know this is an old post but I am really suprised that by now that a group of cooperative VB programmers have not clubbed in to create a freeware VB database with SQL support.

    Are you still around (*bump*)???

  13. #13

    Thread Starter
    PowerPoster cafeenman's Avatar
    Join Date
    Mar 2002
    Location
    Florida
    Posts
    2,819
    I never intended for this code to be that kind of database. Almost all my apps write a file for something or other that doesn't need the support or overhead of a "real" db system.

    In the past I had simply regurgitated the same code and made changes as necessary. I wrote VB DB to give me an easy framework and simplify the process.

  14. #14

    Thread Starter
    PowerPoster cafeenman's Avatar
    Join Date
    Mar 2002
    Location
    Florida
    Posts
    2,819
    This is the last version of the app. I think it was as finished as I was going to make it, but it's been a long time since I've looked at it.

    If there are any problems with it, you'll have to work them out. I'm not doing any coding in the near to distant future.
    Attached Files Attached Files

  15. #15
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170
    Originally posted by cafeenman
    This is the last version of the app. I think it was as finished as I was going to make it, but it's been a long time since I've looked at it.

    If there are any problems with it, you'll have to work them out. I'm not doing any coding in the near to distant future.
    You just might come back to a bit of coding for your flying-plane-thing... categorizing all those planes with the weird names and whatnot.

  16. #16
    Fanatic Member MikkyThomeon's Avatar
    Join Date
    Oct 2002
    Location
    At work...
    Posts
    648
    Thanks for your reply cafeenman (cool alias and most appropriate!!!)

    I have an urgent winsock post that needs to be resolved and I will be back onto this one soon.

    The app that I have currently only has two tables and so your help here might just do the trick... I am using access right now in some of the apps I redistribute but this is going to be a problem when the database file grows. Really appreciate your help!! Cool man!!

  17. #17
    Fanatic Member MikkyThomeon's Avatar
    Join Date
    Oct 2002
    Location
    At work...
    Posts
    648
    Hey I used to fly planes as well!!! Here is SA we fly in the sugar cane fields. When your plane goes down in the fields somewhere it is quite an adventure trying to find it!!. The one time my glider went down and I could only get to it the next day. My dad was there holding up a long pole so I could see him from the opposite facing hill. marhing through the fields. Was a real jol!!!

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