Jump to content
Xtreme .Net Talk

Nerseus

*Experts*
  • Posts

    2607
  • Joined

  • Last visited

About Nerseus

  • Birthday 11/28/1971

Personal Information

  • Occupation
    Sr. Software Engineer/Architect
  • Visual Studio .NET Version
    Visual Studio .NET Enterprise 2005
  • .NET Preferred Language
    C#

Nerseus's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. The only thing I've seen that does what you describe is a dedicated install/uninstall program. The three big ones are: Microsoft (built in installer with Visual Studio), InstallShield, and Wise install. There are a number of free ones as well. Keep in mind that none of them just "knows" what gets installed. The person making the installer must tell the installer what's there, and what should get uninstalled. Most will know about folders and files but if you have registry settings, you'll have to tell the installer which branch and keys you have. If you write custom config files, save files, etc., you'll have to tell the installer about them so it can do cleanup later. Fancier installs will even prompt the user on uninstall with something like "Extra config files were detected at [folder name]. Would you like these removed?" I know of no "monitor" that will simply scan/check everything - registry, files, etc. to let you know what's been installed. -ner
  2. I've used both - a simple return type of List<T> and a class that derives from List<T>. Here's how I decide (if-based, because I'm a programmer :) ) If the list is "internal" only - just a quick return type so I can iterate over the list, use the simple List<T> return type. Else create a class. More often than not, once I have created the class I find a reason to add a method or two. -ner
  3. I believe you can use "this.DesignMode" or "Me.DesignMode" to check, and prevent, accidental writing of things like the Text property. I've used that on classes that inherit from Form but should work for custom/user controls. -ner
  4. In addition to the math issue you've noticed, I'll add that rounding in .net may or may not work as you expect for money. There are generally two ways to round when you encounter a 0.5 number - that is, a number that is exactly halfway between going up or down. By default, .net takes the engineering approach, which makes every other number go up and the opposite go down. So: Math.Round(0.5) = 0 Math.Round(1.5) = 2 Math.Round(2.5) = 2 Math.Round(3.5) = 4 In general, currencly values will always go up at 0.5. When dealing with money, you want this: Math.Round(0.5) = 1 Math.Round(1.5) = 2 Math.Round(2.5) = 3 Math.Round(3.5) = 4 You'll have to make sure you specify the MidpointRounding type. Just a note :) -ner
  5. What DataType is column TimeSheets.Date? Silly question, I know... but you're comparing the column to a varchar in your query so I thought I'd ask. If it's a datetime and your variables are both datetime, then I'd think it would work just fine. Keep in mind that datetime DOES have a time portion so if your table values have time stored, then your "BETWEEN" will likely not include records on the @enddate date. For example: Row 0: Date = '01/11/2007 1:32pm' Row 1: Date = '01/12/2007 2:32pm' If @start = '1/11/2007' and @end = '1/12/2007' then it will NOT pick up Row 1. The two common fixes are: 1. Change the query to not use BETWEEN, but use something like: TimeSheets.Date >= @start and TimeSheets.Date < (@enddate + 1 day) You'll use something like DATEADD(d, 1, @enddate) for that last bit. 2. Change the @enddate to be the END of the date you're checking: SET @endDate = '1/12/2007 11:59:59pm' TimeSheets.Date BETWEEN @start and @endDate -ner
  6. I'm not sure which column it is, but it doesn't seem too hard to figure out on your end. Here's what I'd look at: Looking at your ChangeControls table and see which columns don't allow NULL (marked as NOT NULL). If there are only a few, this makes things easier. In method UpdateChangeControls, look at the parameters and see which of the columns have value DBNull.Value instead of a valid value. That should pinpoint the current issue. Some columns seem fine, like "Status" which are hard-coded to have a value like "Open" To help find these types of issues earlier, you can define the columns in your DataSet to have the same properties as those of your DB table. Suppose your table has column "Name" as NOT NULL. When you define your DataSet, just make sure to have the column not allow nulls as well. You set this through the "MinOccurs" property - using a value of zero will make it not allow nulls. If you need to temporarily allow nulls, you can set the nillable property to true. That will allow you to put DBNull.Value in the non-null column until you try and commit - then the nillible=false property will prevent you from saving. -ner
  7. Not sure what you mean by "dotnet not c#" - maybe you mean VB.NET? If so, the article I linked to actually mentions this next article, which has the same code in VB.NET: http://www.dotnet247.com/247reference/msgs/10/51694.aspx Good luck!! -ner
  8. The term you're looking for is "rounded rectangle" - that might help when you go googling for samples. I've attached a sample C# project that should do what you want. The project contains two main files: Form1 and ExtendedGraphics. ExtendedGraphics was taken directly from CodeProject, found here: http://www.codeproject.com/cs/media/ExtendedGraphics.asp Form1 shows just one way to draw the rectangles. I chose to override the OnPaint event of the form, which gives you a Graphics object. Some people use timers (for a game possibly) and will create their own Graphics object. There are some samples on these forums on how to get that working. It's an artform, in a way, to get fast graphics to draw and often comes down to just how much drawing you'll be doing. -ner GUIDrawing.zip
  9. My initial thoughts went like this: Wow! (pause) I wonder if it will be useful at all... (pause) Wow! I bet there's a LOT of good info to be gleaned by seeing their code and how they implemented/documented things. I've never had any trouble with the .Net framework regarding bugs. Now 3rd party software, that's where you want the source! -ner
  10. That's right, FULL source for libraries like System.Windows, System.Web, System.Data (ADODB) and more!!! Expected later this year. See article below for more info: http://weblogs.asp.net/scottgu/archive/2007/10/03/releasing-the-source-code-for-the-net-framework-libraries.aspx -ner
  11. The syntax you're looking for is: EXECUTE @text = SP_HELPTEXT... But a few problems. 1. You can't create a local "text" variable. You can replace "DECLARE @text text" with "DECLARE @text varchar(max)". NOTE the (max) syntax is SQL 2005 specific. Doesn't matter, it won't work :) 2. The assignment usage you're trying only takes the RETURN value and puts it into a variable. The sp_helptext proc returns the text via a SELECT statement. So, assuming the sp_helptext call works, it RETURNs a value of 0. So if you do #1 above, you'll simply get '0' in @text. The sp_helptext proc really just looks at the system tables. I've used sp_helptext for a quick and dirty in a query window. But you may be better using the system tables. Here's the query I generally use: select text from syscomments where id = (select id from sysobjects where xtype='p' and name = 'procname') I've hard-coded the xtype to 'p' for proc, in case you have a proc and table with the same name. I believe there's an object_id function that can be used to get the ID instead of my subselect on the sysobjects table, but I can never remember it (I had to look it up for this post) :) One last note. In SQL 2005 the system tables are "better" accessed though some new system views, such as sys.objects. I don't really know the difference, but if this is production quality code or you're just a pureist, you may want to investigate those. -ner
  12. Hmm... I'm guessing the problem from all the methods that don't work, is that they're operating off the window handle and having the window draw itself into the offscreen surface. Maybe the trick is to use the screen's handle itself so that it can pick up all the windows, including the tooltip. I'm sorry I've got no code or link to help, but thought the info might spark something else to try if you've run dry. -ners
  13. I've never seen a database treat them differently. Really? I've always seen BETWEEN treat things inclusively. So BETWEEN 1 and always picks up 1, 2, and 3. At least as far as SQL Server is concerned, there is no column that only holds a date. Everything has a time. Even if you insert '8/28/2007', SQL will tag on '12:00:00AM' - exactly midnight. If you have two rows on the same day, different times, then even MrPaul's query won't work. The best and easiest query I've used is one that uses the following day, as in: WHERE column >= @DateParam AND column < @DateParamPlusOneDay For example, to find all rows with a date on 8/28/2007 regardless of the time: WHERE column >= '8/28/2007' AND column < '8/29/2007' You *could* use BETWEEN, but the 2nd value in the expression would have to include the last possible second of time, such as: WHERE column BETWEEN '8/28/2007' AND '8/28/2007 11:59:59.999PM' -ners
  14. I've done exactly what you have Mondeo - differently named functions and a little more robust, but essentially the same concept. I was hoping it would have been alleviated with .net 2.0 and the inclusion of nullable types. They help, but you still need to translate between DBNull and null/Nothing. -ner
  15. Offhand, 200 sounds like a LOT of columns - just a general purpose bad smell. As far as limits, SQL Server has an 8k limit. Meaning, any one row of data in a table cannot exceed 8192 bytes, give or take. 200 fields at 8 bytes each is only 1600 bytes so you're ok there. -ner
×
×
  • Create New...