Page 2 of 2 FirstFirst 12
Results 41 to 58 of 58

Thread: Problem in my Application

  1. #41
    PowerPoster
    Join Date
    Jun 2015
    Posts
    2,224

    Re: Problem in my Application

    No need to complicate things by jumping to VB.NET -- ADO has async functionality built in.

    https://support.microsoft.com/en-us/...ing-withevents

  2. #42
    Wall Poster TysonLPrice's Avatar
    Join Date
    Sep 2002
    Location
    Columbus, Ohio
    Posts
    3,835

    Re: Problem in my Application

    No need to complicate things by jumping to VB.NET -- ADO has async functionality built in.
    My bad...wrong forum
    Please remember next time...elections matter!

  3. #43
    PowerPoster
    Join Date
    Jun 2015
    Posts
    2,224

    Re: Problem in my Application

    Quote Originally Posted by TysonLPrice View Post
    My bad...wrong forum
    10 lashes!

  4. #44

    Thread Starter
    Junior Member
    Join Date
    Jan 2017
    Posts
    24

    Re: Problem in my Application

    Thanks TysonLprice
    it is near to what i want but i need avoid my Form From Hanging When read large data form database and response to user events
    and do all operation from user while my Old operation is still running(Reading Data From My DB)

    User do not need to Wait the operation and then do another
    specially when read large data from database it consume a time

  5. #45
    Frenzied Member
    Join Date
    Dec 2008
    Location
    Melbourne Australia
    Posts
    1,487

    Re: Problem in my Application

    You do not provide enough information, and have not answered all the questions.
    Can you trim down and attach your project ?
    If there is sensitive information in your DBs, then replace the data with less sensitive information.
    If you don't do something (eg answer questions), this will drag on for ever.

    Perhaps the retrieving of data is not causing the slow problem, you may be updating a live (not disabled) grid, and that is slowing you down.
    That is just one guess. But that is all we can do with the lack of information.

  6. #46
    Frenzied Member
    Join Date
    Dec 2008
    Location
    Melbourne Australia
    Posts
    1,487

    Re: Problem in my Application

    OOPs double post.
    When I post I get a message saying wait 30 seconds.
    I checked that the 1st post was absent, and tried again.

  7. #47
    PowerPoster
    Join Date
    Jun 2015
    Posts
    2,224

    Re: Problem in my Application

    How to open a Large recordset and respond to user events, without hanging the form ---> FOLLOW THIS LINK https://support.microsoft.com/en-us/help/190988/how-to-open-ado-recordsets-asynchronously-using-withevents

  8. #48

    Thread Starter
    Junior Member
    Join Date
    Jan 2017
    Posts
    24

    Re: Problem in my Application

    Fro Examaple
    ADodcShow.recordsource=Select * From Customers where DepID=205
    ADodcShow.refresh

    set DataGrid1.Datasource=ADodcShow

    Assume that this query return 15000 Record My Form is hanging while processing
    this and user have to wait for long seconds
    i hope that user can use the form for and another purpose while processing query

  9. #49
    Frenzied Member
    Join Date
    Dec 2008
    Location
    Melbourne Australia
    Posts
    1,487

    Re: Problem in my Application

    Quote Originally Posted by Hares View Post
    Fro Examaple
    ADodcShow.recordsource=Select * From Customers where DepID=205
    ADodcShow.refresh

    set DataGrid1.Datasource=ADodcShow

    Assume that this query return 15000 Record My Form is hanging while processing
    this and user have to wait for long seconds
    i hope that user can use the form for and another purpose while processing query
    Try this -
    ADodcShow.recordsource=Select * From Customers where DepID=205
    DataGrid1.Enabled = False
    set DataGrid1.Datasource=ADodcShow
    DataGrid1.Enabled = True

    I don't think you need this line -
    ADodcShow.refresh

    And I would sleep better at night, if you did not use the DataControl at all.
    Also I don't like binding.
    You would get much better performance using -
    - Pure ADO code to create a disconnected rs
    - Use pure code to load the rs contents into a flexgrid (NO BINDING)

  10. #50
    PowerPoster
    Join Date
    Jun 2013
    Posts
    7,253

    Re: Problem in my Application

    Quote Originally Posted by Bobbles View Post
    You would get much better performance using -
    - Pure ADO code to create a disconnected rs
    - Use pure code to load the rs contents into a flexgrid (NO BINDING)
    That's not true.

    The DataGrid is the only Grid- (or List-)Control in the Standard-ControlSet of VB6,
    which works "virtually" (not copying Data over into the Control itself).

    Because of this, it is (with large RecordSets) by miles and bounds faster,
    compared to a "manually to implement copy-over-loop" on a FlexGrid.

    Just make your own tests.

    Also, DataBinding is *good* (because it reduces coding-efforts significantly) -
    and if the ADODC is not "up to ones specific task", one can write his own Record-Navigator-Control
    (using the ADORs-Event-Interface).

    @Hares
    I suspect, it is not the Client-GUI which is slow,
    instead I'd think it is the DBEngine which slows things down when processing your Query:
    Select * From Customers where DepID=205

    Ways to reduce the stress on the DB-engine:
    - reduce the amount of Columns to return, by giving a specific FieldName-List (instead of using *)
    - make it easier for the DBEngine to filter specific DepIDs, by defining an Index on your Customers.DepID-Field
    .. (either via VB6-code, or via GUI in Access, in case you're using an *.mdb)

    HTH

    Olaf

  11. #51

    Thread Starter
    Junior Member
    Join Date
    Jan 2017
    Posts
    24

    Re: Problem in my Application

    Thanks Bobbles ,SChmidt
    Even i have best performance My Question Why i can not use my form by use to do something at the same time it is porcessing task
    One task is running in backgroud and othrer task is run at same time

  12. #52
    PowerPoster
    Join Date
    Jun 2013
    Posts
    7,253

    Re: Problem in my Application

    Quote Originally Posted by Hares View Post
    Even i have best performance My Question Why i can not use my form by use to do something at the same time it is porcessing task
    One task is running in backgroud and othrer task is run at same time
    Here's two "rules" for you:
    - if there is no need to perform async-Ops, you should avoid them ("linear" code is less error-prone, much easier to write and understand).
    - wasting CPU-cycles unnecessarily, is not considered "good style"

    That said ... as others have already pointed out to you further above in this thread -
    you could (quite easily) perform async ADO-Rs-Requests against your DBEngine.

    But (considering the two "rules" above) -
    you should avoid them, when your request can be tuned (quite easily),
    to deliver your ADO-Rs "within a decent response-time, not stressing the DBEngine".

    Let's say, currently your DB-request returns your ADO-Rs in 10seconds (blocking your GUI in that time) -
    and your CPU has to run "full throttle" over these 10seconds, wasting completely unnecessary cycles in the DBEngine).

    If you can reduce these 10seconds by factor 100 with a single line of code (down to a tenth of a second) -
    just by setting a DB-index on a certain DBTableField, you are "all around better off", because:

    - Your code does not have to be changed to properly handle async-stuff (it can remain linear, easy to maintain).
    - Your GUI-Response-time is factor 100 better.
    - You will not suck your Clients Notebook-Battery dry in record-time, due to "entering 100% CPU-Core-Load" for only 0.1 seconds instead of 10.

    Olaf

  13. #53

    Thread Starter
    Junior Member
    Join Date
    Jan 2017
    Posts
    24

    Re: Problem in my Application

    Thanks SChmidti will try you told me
    Sorry i have another problem and i will be Crazy Why it happened

    Set cmd = New ADODB.Command
    cmd.ActiveConnection = CN

    cmd.CommandType = adCmdStoredProc
    cmd.CommandText = "ShowCust"
    cmd.Parameters.Append cmd.CreateParameter("MyQesmID", adInteger, adParamInput, 6, Val(Text1.Text))

    rs.ActiveConnection = CN

    Set rs = cmd.Execute
    Set MSHFlexGrid1.DataSource = rs ' this get data
    Set MSHFlexGrid1.DataSource = rs ' this not get data

    My recordset not saved the data on it why

  14. #54

    Thread Starter
    Junior Member
    Join Date
    Jan 2017
    Posts
    24

    Re: Problem in my Application

    Thanks SChmidti will try you told me
    Sorry i have another problem and i will be Crazy Why it happened

    Set cmd = New ADODB.Command
    cmd.ActiveConnection = CN

    cmd.CommandType = adCmdStoredProc
    cmd.CommandText = "ShowCust"
    cmd.Parameters.Append cmd.CreateParameter("MyQesmID", adInteger, adParamInput, 6, Val(Text1.Text))


    Set rs = cmd.Execute
    Set MSHFlexGrid1.DataSource = rs ' this get data
    Set MSHFlexGrid1.DataSource = rs ' this not get data

    My recordset not saved the data on it why
    Last edited by Hares; Sep 1st, 2019 at 09:52 AM.

  15. #55
    PowerPoster
    Join Date
    Jun 2013
    Posts
    7,253

    Re: Problem in my Application

    Cannot make head or tails from your code-snippet... (sorry).

    You have to make your problems (or errors) easily reproducable for others to be able to help.
    So, why not zip-up a small example-project (along with a small DB), uploading it here.

    Olaf

  16. #56

    Thread Starter
    Junior Member
    Join Date
    Jan 2017
    Posts
    24

    Re: Problem in my Application

    My Database is sql server online i can not attach it , the Question after i use stored procedure
    Set rs = cmd.Execute
    Set MSHFlexGrid1.DataSource

    i can not use recordset again

  17. #57

    Thread Starter
    Junior Member
    Join Date
    Jan 2017
    Posts
    24

    Re: Problem in my Application

    My Database is sql server online i can not attach it , the Question after i use stored procedure
    Set rs = cmd.Execute
    Set MSHFlexGrid1.DataSource

    i can not use recordset again

    I am sorry i can not post new Question and repeat my reply
    and i can not delete my repeated reply
    i think i am stupid
    Last edited by Hares; Sep 1st, 2019 at 12:27 PM.

  18. #58
    PowerPoster
    Join Date
    Jun 2013
    Posts
    7,253

    Re: Problem in my Application

    Quote Originally Posted by Hares View Post
    My Database is sql server online i can not attach it , ...
    i can not use recordset again
    Still not enough information ... can only take a wild guess, that ensuring a:

    xxx.CursorLocation = adUseClient

    ...in all your ADO-Objects (Cnn, Cmd, Recordset) - would rule a few potential problems out.

    Olaf

Page 2 of 2 FirstFirst 12

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