Results 1 to 15 of 15

Thread: [RESOLVED] Resordset

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2000
    Posts
    462

    Resolved [RESOLVED] Resordset

    Just want to let you guys know that all of you that said it could not be done.

    That I did what I wanted to do and it works like a charm.

    I will now be able to do my edit/insert/delete as I designed it.
    Don
    (OLD DOS Programmer)

  2. #2
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: Resordset

    1) What the heck are you talking about? If this is related to another thread, a) either it should have been in that thread, or b) at least post a link to it.

    2) How/What did you solve? Don't hold back, show us how insignificant we really are.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2000
    Posts
    462

    Re: Resordset

    I posted Theads on questions about extracting data from a database and putting it into varibles and then doing edit/insert/delete using a mshflexgrid.

    Was told this would not work I got it to work fine and was able to save all changes I made on the grid.

    Just wanted to let every one know I worked it out

    What I applyed was an old DOS method that I have been using for years now.
    Don
    (OLD DOS Programmer)

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2000
    Posts
    462

    Storing Varibles in recordsets

    This is how I Accomplished the storing of the Varibles
    This is a modified Microsoft Routine I found on there site

    Acct is the Account number

    Tables is the Table Name I am Storing

    VB Code:
    1. Sub Store_Other(Tables As String, DDD As Integer)
    2.      Dim BookArray() As Variant
    3.      Dim I As Integer
    4.      Record_Sets.Open "SELECT * FROM " & Tables & " WHERE Account = '" & Acct & "' ORDER BY Record", Data_Connection(1), adOpenStatic, adLockOptimistic, adCmdText
    5.      I = 0
    6.      Record_Sets.MoveFirst
    7.      Do While Not Record_Sets.EOF
    8.       If InStr(1, Record_Sets("Account"), Acct) Then
    9.        ReDim Preserve BookArray(I)
    10.        BookArray(I) = Record_Sets.Bookmark
    11.        I = I + 1
    12.       End If
    13.       Record_Sets.MoveNext
    14.      Loop
    15.      Cq = 1
    16.      Record_Sets.Filter = BookArray
    17.      Do While Not Record_Sets.EOF
    18.       Select Case DDD
    19.        Case 1' Created 50 records By Customer
    20.         Record_Sets("Quanity") = Data(2, Cq, 1)
    21.         Record_Sets("Item_Number") = Data(2, Cq, 2)
    22.         Record_Sets("Description") = Trim(Data(2, Cq, 3))
    23.         Record_Sets("Cost_ea") = Val(Data(2, Cq, 4))
    24.         Record_Sets("TotalCost") = Val(Data(2, Cq, 5))
    25.        Case 2 'Created 20 records By Customer
    26.         Record_Sets("Zone_Number") = Data(3, Cq, 1)
    27.         Record_Sets("Description") = Data(3, Cq, 2)
    28.        Case 3'Created 20 records By Customer
    29.         Record_Sets("Phone") = Data(4, Cq, 1)
    30.         Record_Sets("Aname") = Data(4, Cq, 2)
    31.         Record_Sets("Note") = Data(4, Cq, 3)
    32.        Case 4'Created 20 records By Customer
    33.         Record_Sets("Phone") = Data(5, Cq, 1)
    34.         Record_Sets("Code") = Data(5, Cq, 2)
    35.         Record_Sets("Aname") = Data(5, Cq, 3)
    36.         Record_Sets("Note") = Data(5, Cq, 4)
    37.        Case 5'Created 20 records By Customer
    38.         Record_Sets("CodeName") = Data(6, Cq, 2)
    39.         Record_Sets("Codes") = Data(6, Cq, 1)
    40.        Case 6'Created 50 records By Customer
    41.         Record_Sets("AName") = Data(6, Cq, 2)
    42.         Record_Sets("Codes") = Data(6, Cq, 1)
    43.       End Select
    44.       Cq = Cq + 1
    45.       Record_Sets.MoveNext
    46.      Loop
    47.      Record_Sets.Close
    48.   End Sub

    My Database is more along the line of Random than a True Database

    Just passing along How I did this.
    Last edited by Dbee; Sep 6th, 2006 at 10:57 AM.
    Don
    (OLD DOS Programmer)

  5. #5
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: [RESOLVED] Resordset

    I'm curious - since I've never seen something like this...

    What is the point of:

    If InStr(1, Record_Sets("Account"), Acct) Then

    Since you already have:

    Record_Sets.Open "SELECT * FROM " & Tables & " WHERE Account = '" & Acct

    Isn't that INSTR going to be true for every row in the RECORDSET?

    What is the DATA() array? Is that your GRID?

    Are you actually updating the RECORDSET from the DATA array?

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  6. #6

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2000
    Posts
    462

    Re: [RESOLVED] Resordset

    Like I said Its a modifyed Routine from Microsoft

    You were correct took I it of out of the routine. I will remember that from now on.

    The Data() is for 8 different tables.

    And I do use a grid but I also use an Insert/delete/Edit routine. I found this to be the fastest method of data entry for me. I am sure there are faster methods just not found them yet.

    I use this routine to edit information and also to get information from other Data files Like Equipment,Zone Names,Central Station Codes,Police Departments,that pertain to my type of business.

    I like the database concept but I use it a different, but it works

    I can still quary it by the select method.

    An Yes I am updateing from the Data Array To me its Faster

    Let me give you this informattion I use 106 Lables to display one of tables Information.

    I edit all of these Lables by a custom Program that I wrote that uses only 1 Textbox, Like all my forms I use this same routine.

    Just makes creating a Form alot faster.
    Last edited by Dbee; Sep 6th, 2006 at 08:07 PM.
    Don
    (OLD DOS Programmer)

  7. #7
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: [RESOLVED] Resordset

    Thanks for the clarifications...

    I guess a benefit to using a RECORDSET for update to a table is that you are most likely holding locks against those rows while the updates are taking place. If needed - that's a good thing.

    We call a "stored procedure" to update each row in our FLEXGRID's one-row-at-a-time. If you don't do MS SQL Server and have never used a "stored procedure" it's basically an action query (the UPDATE query in this case) that's wrapped in a function-like object in the DB. Each parameter of the SPROC represents a column in the grid.

    We only call the update SPROC if the row has been changed.

    That would be similar to actually building an UPDATE string:

    "UPDATE SOMETABLE SET SOMECOL=" & FLEXGRID.TEXTMATRIX(r,c)...

    and executing that UPDATE string.

    Benefit's to this is that we are not holding locks against any rows in the table. We generally see locks as a negative thing - users holding locks that potentially go on until they click some EXIT/DONE button put a strain on a large enterprise database application.

    At any rate we have taken our concept to the n-th degree at my shop. Each "screen item" - text box, combo box, flex grid - is drawn on the form at runtime. The position, size and order of the items comes from a table in the DB - so in essence we clone forms at runtime out of nothing. The queries to VIEW, INQUIRE and UPDATE (and validate) each of these screen items on our forms sits in stored procedures in the DB as well. So basically we create a form doing no VB code whatsoever - and rely on "properly named" objects in the DB to move data to and from those screen objects.

    When we started our mainframe-to-VB+MSSQL conversions 6 years ago we realized that creating a VB form for every screen our customers used on the mainframe would be a month-long project for each one. When in reality every UI form basically does the same functionality (as you mentioned!).

    Many ways to skin a cat...

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  8. #8

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2000
    Posts
    462

    Re: [RESOLVED] Resordset

    Thanks.

    I agree it would be nice to update any changes to the Rows as you go the only thing that stops me from that is deleting of a row.

    The way I am doing this is just a simple move of data from one Varible to another by Row.

    I am totaly new to Databases my thing for a number of years before I switched to Vb as Quickbasic PDS 7.1

    I converted alot of my programs over to Vb.

    Thought it was about time to try databases

    As for SQL Server I do not have it and as I looked one the net I don't think will pay 1,000 for it.

    Again thanks for you comments.

    I don't have a screen shot or I would show you the From as I have created it
    Last edited by Dbee; Sep 7th, 2006 at 01:07 PM.
    Don
    (OLD DOS Programmer)

  9. #9
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: [RESOLVED] Resordset

    Keep in mind that there are free versions of MS SQL Server - SQL Server Express (MS SQL 2005) and MSDE (MS SQL 2000)...

    Free to download - free to distribute - with some cap's on numbers of users and things like that.

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  10. #10

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2000
    Posts
    462

    Re: [RESOLVED] Resordset

    You got any Locations of this Free ware so to speak.

    I have notice that there are lots of users of SQL

    By the way what is the atvantage of SQL over Access
    Don
    (OLD DOS Programmer)

  11. #11
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: [RESOLVED] Resordset


    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  12. #12

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2000
    Posts
    462

    Re: [RESOLVED] Resordset

    I am downloading SQl Express now. And Thanks for the Info on there Location.


    But I still have about 15 programs to covert to Access Database that I created.

    The reason for the conversion was corrupted Random Files had to many go south on me.

    Let me ask you this is SQL more for Xp than the win2000 I run on all my machines
    Don
    (OLD DOS Programmer)

  13. #13
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: [RESOLVED] Resordset

    MS SQL is for everything...

    It's a true server database - it doesn't become corrupt (like ACCESS can)...

    We were mainframe for 25 years until MS SQL 2000 came out - the first MS SQL product that viable for our customers to use...

    Our customers are large (school district's with 1000+ teachers - potentially all connecting at the same time) and health insurance processing - tables with 3 or 4 million rows...

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  14. #14

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2000
    Posts
    462

    Re: [RESOLVED] Resordset

    Like I said I Do want to thank you for your time and for stearing me another way.

    I will give it a look see.

    Might be back with more Brain pickers so to speak on the subject.

    But for Now I got to get the programs going got invoices and Statements to do.


    Let me say this and I hush I have been working in Vb for about 6 years. And only scratch the surface of its power.

    Still in the learning process for an old man of 63
    Don
    (OLD DOS Programmer)

  15. #15
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: [RESOLVED] Resordset

    Programming is certainly a life long addiction

    Good luck...

    Hope to see new threads with new questions from you soon!

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

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