|
That's OK then.
Now to see how slow that really is, you should replace the exception by a somewhat equivalent return or goto statement and see the difference.
|
|
|
|
|
is that a debug build running inside Visual Studio? (which VS?)
is the first exception included in the measurement?
Visual used to be very slow at dealing with the first exception; and for throughput measurements one should not include the beginning (unless it gets averaged out by observing a large time, say > 1 minute).
could be less than 1.
|
|
|
|
|
Good points - I'll check the results outside VS.
Regards,
Rob Philpott.
|
|
|
|
|
Yes, my whole experiment was flawed by forgetting about running things outside Visual studio. Results are in the above post.
All-in-all, its nowhere near as bad as I thought. 17 microseconds per exception. 50,000 odd a second. Perhaps they're not as evil as all that.
Regards,
Rob Philpott.
|
|
|
|
|
They're just as evil as ever when no one comments that they're expecting an exception for some innocuous looking piece of code.
The true man wants two things: danger and play. For that reason he wants woman, as the most dangerous plaything.
|
|
|
|
|
Rob Philpott wrote: Using them to control execution flow is criminal.
So the chap that wrote the ASP.NET page redirection mechanism should be locked up for all those ThreadAbortExceptions
|
|
|
|
|
Not familiar with him, but it sounds like you should throw away the key....
Regards,
Rob Philpott.
|
|
|
|
|
Wait a minute, exceptions are supposed to alter execution flow,
how else would they be any better than on error resume next ?
|
|
|
|
|
Luc Pattyn wrote: Wait a minute, exceptions are supposed to alter execution flow
Agreed, but only in exceptional circumstances!
Regards,
Rob Philpott.
|
|
|
|
|
Hi Guys,
I am having problem when running the Following SQL script.It takes Pretty long time to return result.
I am having about 500,000 records in my database.
select count(distinct(CR_Cli)),SO_name from Callrecords inner join dbo.StudioOperators
On CR_StudioOperatorID=SO_ID
where datename(month,cr_callstart)='April'
and Cr_cli not in (select Cr_cli from Callrecords where cr_callstart<'2009-03-31')
group by SO_name desc
Is there any way i can write this script?
Thanks you very much.
|
|
|
|
|
You do realise that there are several Database related fora on CP?
This is a C# forum.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Sorry I couldnt get SQL forum From the Message Board List.
I will Try MYSQL.
Thank you
|
|
|
|
|
How about the "General Database" forum??
|
|
|
|
|
General Database might be better, if it is MS SQLServer.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
It´s very hard to rewrite a SQL query that I didn´t know the schema and relationships. Anyway, I made some changes.
kibromg wrote: select count(distinct(CR_Cli))
Verify if the column has an index.
kibromg wrote: datename(month,cr_callstart)='April'
Do not use much functions on where clause. Simplify... use "month(CR.callstart) = 4".
kibromg wrote: and Cr_cli not in (select Cr_cli from Callrecords where cr_callstart<'2009-03-31')
If Cr_Cli "not in" where cr_callstart < '2009-03-31 then Cr_Cli "is in" where cr_callstart > '2009-03-30'. More than that, you are already referencing Callrecords in inner join, so you don´t need to create a subselect. On where clause, use this condition: "CR.callstart > '2009-03-30'".
kibromg wrote: group by SO_name desc
On group by you have the column SO_name. Does this column have an index?! If not, you must consider creating one.
Try the code below, maybe it helps.
<br />
select count(distinct(CR.Cli))<br />
, SO.name<br />
from Callrecords CR<br />
inner<br />
join StudioOperators SO<br />
on CR.StudioOperatorID = SO.ID<br />
where month(CR.callstart) = 4<br />
and CR.callstart > '2009-03-30'<br />
group by SO.name desc<br />
|
|
|
|
|
I have a method in my Webservice:
[WebMethod]
public ReturnList GetList(string id, System.DateTime fromDate)
If I enter a invalid date when testing the service, I get a custom html-page with the errormessage and a stacktrace.
How can I get rid of this?
I want to handle the parsing of the incoming date myself, and send back a ReturnList object with a custom errormessage.. But I don't want to use string instead of dateTime, since I want it to be specified as dateTime in the wsdl..
|
|
|
|
|
What about using an overload that way if it is passed in as something other then a valid DateTime object it will get treated by the overlaoded method and there you can try parsing it manually:
<code>
[WebMethod]
public ReturnList GetList(string id, string fromDate)
{
}
[WebMethod]
public ReturnList GetList(string id, System.DateTime fromDate)
{
}
</code> Worth a try ... hth
|
|
|
|
|
Hi,
I would like to make a column of listview, invisible. by setting width property to zero, I can achieve this.
But, when I am trying to increase or decrease the width of previous or next column with mouse drag then the hiden column automatically get displayed.
Any solution for that ?
Like
making that column invisible. OR
making mannual resizing of any column as false
Please help me in this regard.
Thanks in advance
|
|
|
|
|
You can override the painthandler; you got some extra control when owner-drawing. It may be more suitable to put the contents of the hidden column somewhere else. Like a Dictionary , linking each value to a ListViewItem
I are troll
|
|
|
|
|
Object cannot be cast from DBNull to other types.
what does this mean
|
|
|
|
|
benson.misi wrote: Object cannot be cast from DBNull to other types
this means... Object cannot be cast from DBNull to other types
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
Maybe you could post the code that cause this error? This will help us to help you...
|
|
|
|
|
'Help' is not a great subject: please read posting guidelines [^] before actually posting.
benson.misi wrote: Object cannot be cast from DBNull to other types.
what does this mean
You're possibly relying on a db antry that, instead, is missing.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
I'm guessing you are doing something like:
if(row["blah"]==null)
and it should be
if (row["blah"] == DBNull.Value)
?
|
|
|
|
|
Hi all,
Hope I am posting this in the right forum.
I seem to be having a problem when using serialization and web services.
Scenario:
I have built a web service which includes a multitude of web methods. All the web methods have various parameters, but one parameter which they all have in common is an 'object' parameter. This is due to the fact that the web service works differently according to the type of object being passed into it.
Now as for the objects, I have constructed a set of custom classes which satisfy my need. For example's sake, let us say we have:
Teacher class
Student Class
LectureRoom Class
Lecture Class
We will call these the "School Package classes"
I am then wrapping these classes within other custom classes which I use not only to transport my objects around but also to keep track of statuses etc. Example:
Request Class
Response Class
The school package classes would be serialized and saved within the request or response class. So effectively, the objects which the web service really sees are the request and response classes which will in turn have the school package classes inside of them.
The Problem:
The problem is found when a school package object is passed within the response and request object. On deserialisation or transportation of these objects, the web service always throws an exception as follows:
{"System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.InvalidOperationException: There was an error generating the XML document. ---> System.InvalidOperationException: The type <classname> was not expected. Use the XmlInclude or SoapInclude attribute to specify types that are not known statically.
From what I could gather and the research I have done, the problem lies with the web service not knowing of the object types at compile time.
Make Shift Solution:
For a quick and dirty solution I created methods within the web service which use the object types needed. For Example:
public void Junk(Student myStudent){}
This seemed to have worked, but is not what I want, as with about 40 custom classes, this is both horrible coding and very tedious.
I have also tried researching the xmlinclude and soapinclude found in the System.Xml.Serialization library, but dont really know how to use these. I have tried adding them above the web service class declaration and the web methods which use the objects in this format:
[XmlInclude(typeof(Student))]
But yet to no avail. I have officially run out of ideas and would greatly appreciate anyone who has experience or ideas regarding this problem.
Thank you very much in advance for your time and excuse the length of the post.
James Bason
|
|
|
|