|
Thank you for your answer.
To answer your question why, I have written an Ad-Hoc query tool for a very large database. I have a query that is returning 300K+ records and it takes the DataGridView forever to load all those records when the DataTable is bound to the DataSource property. Hence why I choose to use Just-In-Time data loading.
Apparently the facts in my post were insufficient in revealing I was dealing with large DataTables. My apologies for being unclear with the facts I provided.
|
|
|
|
|
Phoenix Hawke wrote: ... returning 300K+ records and it takes the DataGridView forever ...
Such a design deserves to fail. Nobody will want to read so many lines on screen.
|
|
|
|
|
Bernhard Hiller wrote: Such a design deserves to fail. Nobody will want to read so many lines on
screen.
Thank you for the enlightening review of my design.
Let me make it clear what an Ad-Hoc Query tool is so the design will make more sense to you. An Ad-Hoc query tool allows users to design queries in a query designer much like MS Access using one or many tables and various fields. Given there is such a large amount of flexiblity with this kind of tool a software designer has to take into account queries that will return a large amount of data. I realize that users aren't going to want to see a large number of of records. However, they aren't going to want an interface that takes 10 minutes to load in order for them to realize that is the issue with the query they designed.
There is one more point I would like to bring is forward. You offered absolutely no kind of solution to the issue. If you were trying to help then you to have failed in your design. However, unlike you I will offer another solution to your design. That is, if you aren't going to provide any kind of useful or well thought out suggestions but rather just criticism then please do me favor and move onto another thread where someone maybe enlisting that kind of feedback.
Thanks
|
|
|
|
|
Also we face sometimes the problem, that a user selects filter values for the data which would yield too many rows to be shown. And what do we do there?
We use a threshold for the row count. Of course, that threshold can be configured. If the row count is more than the threshold, a warning message will be shown, and the user can decide to continue with the crazy amount of data (well, he was shown a warning...) or stop to set new filter values.
|
|
|
|
|
Bernhard Hiller wrote:
Also we face sometimes the problem, that a user
selects filter values for the data which would yield too many rows to be shown.
And what do we do there? We use a threshold for the row count. Of course,
that threshold can be configured. If the row count is more than the threshold, a
warning message will be shown, and the user can decide to continue with the
crazy amount of data (well, he was shown a warning...) or stop to set new filter
values.
Thank you for your reply.
That is indeed a very good suggestion. So how might I put this into pratice? Is there some event within the SqlClient.SqlDataAdapter Class that fires during the execution of the query that tracks the rows returned during execution? Or is this something that is implemented during the loading of the records into the DataGridView? I found that using a For Each statement to load records row by row is very slow and inefficent. Is there another method that can be used to create a way to stop the load after so many records have been loaded into the DataGridView?
Thanks
|
|
|
|
|
I do not know if there are events for that (I do not like the DataAdapters, and normally use a DataReader). Before doing the query to fetch the data, you can do a query to get the row count by a simple query : SELECT COUNT(*) FROM (original select query) . Since Microsoft SQL Servers caches a lot, that's not a costly overhead.
|
|
|
|
|
Thanks for the assistance. I will give that try.
However, I am still left wondering why the DataGridView is working differently for the same query on 2 different attempts. Why it's fast the first time but hangs the second and why the blank rows have data from the DataTable when the DataGridView isn't bound and no data has been looaded.
Perhaps someday I will find out why.
|
|
|
|
|
Phoenix Hawke wrote: I have a query that is returning 300K+ records
Nobody is going to look through 300,000 records for anything. On top of that, you're loading all of those into a DataTable, burning up network bandwidth transmitting all those records and burning up memory because you're storing them all in a DataTable.
Virtual mode is intended to give you an oportunity to retrieve only the visible subset of the larger recordset being viewed. For example, if your displayed grid is only 20 rows high, you can retrieve only the 20 rows you can see from the 300,000 available.
|
|
|
|
|
Dave Kreskowiak wrote: Nobody is going to look through 300,000 records for anything. On top of that,
you're loading all of those into a DataTable, burning up network bandwidth
transmitting all those records and burning up memory because you're storing them
all in a DataTable. Virtual mode is intended to give you an
oportunity to retrieve only the visible subset of the larger recordset being
viewed. For example, if your displayed grid is only 20 rows high, you can
retrieve only the 20 rows you can see from the 300,000 available.
Thank you for your feedback.
Your observation is very interesting. I say this becuse the tool returns 300K+ of records in under 6 seconds and 4 of those seconds is the time it takes the query to return results and the other 2 is the load time into the DataGridView. Please keep in mind we are dealing with an Ad-Hoc Query tool which allows the user to design any query they want to. It is up to the application to properly handle what they have designed and return the results in a reasonable amount of time.
I am really asking for advice on why the DataGridView works one way then another way when dealing with the exact same circumstances being executed twice. I defintiely want to enlist other design concepts but criticism without providing another solution is frankly useless to me.
Thanks
|
|
|
|
|
OK, I've told you what the design goal of virtual mode was and how it was intended to work. What you do with that information is up to you.
|
|
|
|
|
I have to write a code where i have to ask user on production lane for identity card. The code would be insert form light scanner. I would like to block press buttons from 0 to 9 by:
Private Sub op1start_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles op1start.KeyDown
If e.KeyCode = Keys.D1 Or e.KeyCode = Keys.D1 Or e.KeyCode = Keys.D2 Or e.KeyCode = Keys.D3 Or e.KeyCode = Keys.D4 Or e.KeyCode = Keys.D5 Or e.KeyCode = Keys.D6 Or e.KeyCode = Keys.D7 Or e.KeyCode = Keys.D8 Or e.KeyCode = Keys.D9 Or e.KeyCode = Keys.D0 Then
e.SuppressKeyPress = True
End If
when the user scans the card. The user has a tablet there he could insert his code by buttons. I have to forbid that.
Could i make events in inputbox?
Please help
|
|
|
|
|
lukaszo44 wrote: The user has a tablet there he could insert his code by buttons.
..and using the clipboard (copy/paste) and probably by entering the ASCII value while holding the alt-key.
Why, isn't the code you posted working?
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
sounds like you are using a scanner which emulates a keyboard.
Basically, when you scan a barcode, it generates the characters in the keyboard buffer area so that the application doesn't realize that the data is coming from a scanner versus coming from the scanner.
The problem with this type of scanner is that you have to have the focus set on the proper input box to capture the data.
What you want is a scanner which writes the data to the serial (USB) port and have your application be responsible for capturing the data. Using this method, there is no way for the operator to enter values into the system from the keyboard or copy/paste buffer.
Good luck.
|
|
|
|
|
Hello,
what is the exact conversion of c# code to vb6.0 code
for these two lines:
FileInfo file = new FileInfo(Server.MapPath(FileUpload1.FileName));
Int64 numofbyte = file.Length
FileStream fs = new FileStream(Server.MapPath(FileUpload1.FileName), FileMode.Open);
BinaryReader br = new BinaryReader(fs);
byte[] DataFile = br.ReadBytes(Convert.ToInt32(numofbyte));
Are there any converters for converting my c# code to vb 6.0 code ?
Thanks,
|
|
|
|
|
Karthik Reddy wrote: Are there any converters for converting my c# code to vb 6.0 code ?
No. That would be blasphemy.
Karthik Reddy wrote: Server.MapPath
VB6 is not a web-technology. You'd have to write a custom method to replace this.
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
Karthik Reddy wrote: Are there any converters for converting my c# code to vb 6.0 code ?
Why on Earth would anyone write a converter to convert modern code back to something used in the Stone Age??
No, there's no such thing.
|
|
|
|
|
Hello,
I am trying to write a VBscript that allows me to search the file names of every file in a folder and rename them accordingly. For example, I'd like to find all files that begin with RX345678 and replace that name with Bob & MMDD & counter & .txt The counter will allow for the multiple factor. I already have the code for the date, but, it's pulled from an old script and it's been forever since I wrote in VB so my naming is poor.
This is also in Visual Studio 2005 (yeah, I know! )
Thanks for any advice!
|
|
|
|
|
Where is the code you already have, and where are you stuck? Should the serial-number reset after each date, or would you be satisfied with a single range?
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
Sub FormatDate
'Set datepart("yyyy",date()-1) & datepart("m",date()-1) & datepart("d",date()-1)
If len(datepart("m"))=1 Then
monthstr = "0" & datepart("m")
Else
monthstr = datepart("m")
End If
If len(datepart("d")=1 Then
daystr = "0" & datepart("d")
Else
daystr = datepart("d")
End If
objDatestr = datepart("yyyy") & monthstr & daystr
End Sub
Is the current date code. I'm stuck on the proper language to use in order to read the file name and rename it. What I am thinking I would like to have is a routine for each name that could occur. Max = 9. I don't know the number of files per name, so, that's why I was going to add the counter. In each routine, it would search for a specific name and turn that into what I expressed before. I know I sound stupid, but, I know how to code and I know what I want but, this got dumped into my lap and we have no resources here to assist me.
The counter will be set to 0 before each routine. (in my version).
Thanks for anything that points me in the right direction!
|
|
|
|
|
I suggest you start with a routine that lists all the files, and sorts them. Loop through them after that, reset your counter when the date changes.
Most code you'll need can be found here[^].
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
Thanks for the suggestion and the link. I checked it out but, not really sure I'm searching on the right things. Oh well, guess it's off to the book store for some blurry-eyed late nights.!
|
|
|
|
|
Hello,
I've developed a .net dll and made it com Visible and also i've added register for com interoperability.
I need this COM object in visual basic 6.0.
It works fine, when i build the .net component. It generates a .tlb file and i could get my result as expected.
But when i executed this on the other machine it shows error.
i've copied my dll to the other machine and generated a .tlb file by using 'regasm'.
I can see the tlb file in references of my Visual Basic 6, but it is giving error that "Could not load file or assembly 'thirdpartydll' or one of its dependencies".
i've tried by registering with GAC but could not solve my problem .
please help me !
Thanks,
|
|
|
|
|
Did you reference any other libraries in your control?
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
i did not add any library references in vb6.
|
|
|
|
|
Karthik Reddy wrote: I've developed a .net dll and made it com Visible
Which assemblies does your .net dll reference?
--edit;
Rephrased
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
modified 21-Aug-12 6:49am.
|
|
|
|