|
Luc Pattyn wrote: I suggest you just give it a try with a mock query.
The old "Suck it an see" approach!
------------------------------------
I will never again mention that I was the poster of the One Millionth Lounge Post, nor that it was complete drivel. Dalek Dave
CCC Link[ ^]
Trolls[ ^]
|
|
|
|
|
No, get the foundation right.
Spend 1% of your time to make sure you're not about to waste the next 99% of it and ruin your schedule.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
On the drive home I came to the realization that I kind of do something similiar to this already.
In our multi-user environment, we have the concept of check-in and check-out of objects. When you check-out an object, it checks-out all the child objects as well and obviously does a "get latest" in the process. This "get latest" code is what I would need to do in this "speed up" mechanism when the user opens the outer most object.
The check-out process does quite a bit to refresh all the dependent objects. You have to grab all the latest dependent objects kind of from the bottom up so you don't run into RI problems. In case you are going to ask, no, I don't get them one at a time . I wrote a few optimized stored procedures that do inner joins to retrieve various levels of dependent objects at once. So we are probably talking about 4 stored procs to refresh the outer most object and all its dependent objects.
Anyways, the last time I ran a timer on a check-out of the outer most object, I think it took 1 - 3 seconds.
So if I only grab subsets of data, I'd introduce a 1 - 3 second delay.
Not much I can do about that I don't think. I think I ran a profiler on the code and saw most of the overhead was just calling the stored procs and merging the data back into the tables.
|
|
|
|
|
If it is a matter of seconds, the user won't mind. And you can humor him by showing a nice splash screen...
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
Thanks...
I originally implemented it to load full tables to prevent "UI lag". Unfortunately users of the system "abused" the original intent and a few of the tables ballooned to 250k rows :p.
I took your advice and changed it over to just load the chunks of data as they are needed.
Start up time went from 45seconds on my local machine -> 1 to 2 seconds. No noticable UI lag since I'm just loading a few hundred rows.
Offshore guys in India were reporting 5 *minute* start up times. Hopefully they are happier now. I haven't heard how long it takes them now though.
|
|
|
|
|
You're welcome.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
You can not do much if you want to load all the 250K rows. Only thing you can try is loading as much as needed instead of loading all the tables.
Hope this helps.
All the best.
|
|
|
|
|
I need to read emails in Exchange 2010, the move them to another folder. I have the POP3 code done to read the email, but I can't seem to find any examples of how to move the message to another folder.
Anyone know how to do this?
Everything makes sense in someone's mind
|
|
|
|
|
Maybe last week's discussion[^] can help you out.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
On top of Luc's reply, this[^] weeks discussion might also help.
|
|
|
|
|
Hi friends can any body tell me how i can get the information of hardware devices like soundcard and other hardware driver information Using C#
WANTED wasim khan(Killed 50 Innocent Buggs, Distroyed 200 Exception, make 5 Project Hostage) any Compnay Hire him will pay 30,000. Best place where u can get him is Sorcim Technologies Murre Road RWP
|
|
|
|
|
Check out this[^] useful article from the CodeProject archive.
|
|
|
|
|
This Article[^] might help you.
you can also navigate this link[^] having same question with solutions.
|
|
|
|
|
Hello Everybody,
I have a table Tbl_Balance in Which have records of Emp. Have a Look of Table.
Empid ABalance
----- --------
BC101 23000
BC102 -1500
BC103 50000
BC105 -4220
Now I want to show these records in DataGridView like this :
Empid ABalance
----- --------
BC101 23000 DR
BC102 1500 CR
BC103 50000 DR
BC105 4220 CR
How can it possible with the help of DataTable Or Dataset.
Thanks
If you can think then I Can.
|
|
|
|
|
I'm pretty sure there will be an item or row binding event raised by the grid view (without knowing which one you are using, I couldn't possibly narrow it down). In this binding event, you should be able to get the details of the relevant cell and handle it accordingly. If you were using WPF, I'd recommend using a Value Converter to handle it.
Alternatively, you could use a calculated column in your data table (I wouldn't recommmend it, but you could).
|
|
|
|
|
I suggest you read up on the DataGridView.CellFormatting event.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
When you use the next code
Math.Round(5.515* 0.05, 2,MidpointRounding.AwayFromZero)
the result is 5.52
with
Math.Round(6.515* 0.05, 2,MidpointRounding.AwayFromZero)
the result is 6.52
with
Math.Round(7.515* 0.05, 2,MidpointRounding.AwayFromZero)
the result is 7.52
......
but with
Math.Round(4.515* 0.05, 2,MidpointRounding.AwayFromZero)
the result is 4.51
|
|
|
|
|
galache wrote: Math.Round(4.515* 0.05, 2,MidpointRounding.AwayFromZero) the result is 4.51
Very interesting but how do you account for this when the result of 4.515* 0.05 is 0.22575 ?
I think there may be something wrong in your code.
I must get a clever new signature for 2011.
|
|
|
|
|
Sorry, the code is:
Math.Round(4.515, 2, MidpointRounding.AwayFromZero)
the result is 4,51
other example whit decimal type
Math.Round(4.515m, 2, MidpointRounding.AwayFromZero)
the result is 4,52
I think the problem is the double type use in the first example
Thanks
|
|
|
|
|
galache wrote: I think the problem is the double type use in the first example
Yes, one of the inherent problems of representing floating point (and double) values in binary is that they tend to lose accuracy after the decimal point, as they can only be approximations of decimal numbers.
I must get a clever new signature for 2011.
|
|
|
|
|
Hello Everybody,
I have two tables Emp and Dept in DataSet. In which have followind fields.
Emp Dept
---- --------
Emp_No Emp_No
Emp_Name Dept_No
Emp_Sal Dep_Name
Now i want the result in datagridview from both dataset. Result will be look like this.....
Result_In_dataGridview
-----------------------
Emp_no Emp_Name Emp_Sal Dept_no Dept_Name
So please describe me how can i do that by using Code.
Thanks
If you can think then I Can.
|
|
|
|
|
You need to construct a SQL JOIN between the two tables.
Here is a simple example which combines the two into a new table:
static void Main(string[] args)
{
Console.WriteLine("Started");
SqlConnection con = new SqlConnection(strCon);
con.Open();
SqlDataAdapter daMyTable = new SqlDataAdapter("SELECT * FROM myTable", con);
SqlDataAdapter daMyOtherTable = new SqlDataAdapter("SELECT * FROM myOtherTable", con);
SqlDataAdapter daJoined = new SqlDataAdapter("SELECT * FROM myTable INNER JOIN myOtherTable ON myTable.iD=myOtherTable.iD", con);
DataSet ds = new DataSet();
daMyTable.Fill(ds, "My Table");
daMyOtherTable.Fill(ds, "My Other Table");
daJoined.Fill(ds, "My Joined Table");
ShowDataSet(ds);
con.Close();
Console.WriteLine("Stopped");
Console.ReadLine();
}
private static void ShowDataSet(DataSet ds)
{
foreach (DataTable dt in ds.Tables)
{
Console.WriteLine(dt.TableName);
ShowDataTable(" ", dt);
}
}
private static void ShowDataTable(string p, DataTable dt)
{
int cols = dt.Columns.Count;
foreach (DataRow dr in dt.Rows)
{
Console.Write(p);
string sep = "";
for (int i = 0; i < cols; i++)
{
Console.Write(sep + dr[i].ToString());
sep = ", ";
}
Console.WriteLine();
}
}
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
Manfred R. Bihy: "Looks as if OP is learning resistant."
|
|
|
|
|
I Do't have any Connection. I have data in dataset.
If you can think then I Can.
|
|
|
|
|
SqlDataAdapter daMyTable = new SqlDataAdapter("SELECT * FROM myTable", con);
SqlDataAdapter daMyOtherTable = new SqlDataAdapter("SELECT * FROM myOtherTable", con);
SqlDataAdapter daJoined = new SqlDataAdapter("SELECT * FROM myTable INNER JOIN myOtherTable ON myTable.iD=myOtherTable.iD", con);
I am curious why did you get the data seperately instead of using a one query with a "join", getting all the data all once and bing it to gridview?
|
|
|
|
|
Purely to show what I was doing, and that I had two tables in the database.
Seemed worth doing for a beginner in this stuff...
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
Manfred R. Bihy: "Looks as if OP is learning resistant."
|
|
|
|