Jump to content
Xtreme .Net Talk

Nerseus

*Experts*
  • Posts

    2607
  • Joined

  • Last visited

Everything posted by Nerseus

  1. Decimals in SQL Server have two values: precision and scale (or something like that). From the help: My guess is that your scale is 0. -ner
  2. Keep in mind a lot of classes have private fields to keep track of things that won't ever be exposed through a public property or method, but they're still necessary. -ner
  3. Well there you go - SortedList isn't available in the Compact Framework :) -ner
  4. Nope - if you have a Primary Key and your intention is to eventually update the database then you must store the primary key somewhere. Just because your object contains the database's primary key doesn't mean it has to be exposed. If the object has a method to save itself back to the DB, that method could use the private primary key to do it. For child objects you have two options: they can contain the fk value (the CustomerNumber for example) or get it from the parent object. If you wanted to make it more generic, maybe add a new interface called IPrimaryKey that adds a method GetPrimaryKey() that returns the int value. I don't see much benefit in that unless you need that level of abstraction. I would guess you have code somewhere that relies on the relationship between the parent and child and so a known reference between the two is fine. -ner
  5. Can you link to some of them? I'd heard this "rumor" from a co-worker, but he tends to yell out "the sky is *falling*!!!" a lot so I mostly ignore him. -nerseus
  6. I would/do use it whenever I have to split any string and I expect more than two pieces. If I just have two pieces, I'll use IndexOf. I like the readability of the named groups in a regular expresion. I also use it for validation of strings, if needed. My company uses it this way and I love it! There's custom code to do the actual validation, but to define a new "datatype" for a DataSet column we use regular expressions (when needed of course). -nerseus
  7. I'd be curious as to what spawned the question? Did you actually see something that said Mdi is not recommended, or just your personal opinion? I'd go either way - like most solutions, it has its place in certain situations. -nerseus
  8. How would you go about having multiple "child" windows open at once? As an example, it bothers me to no end that I can't view two procs at once in Enterprise Manager. How would you view two table structures at once? -ner
  9. Another note on the "using" block: in the syntax described above, it only works for creating a disposable object (anything supporting IDisposable). You can't use it for a DataColumn object for example. -ner
  10. If it's as simple as appending a string, you can append it in the first example: public MyClass( string s) : this( s + "muh", true ) But why would you be altering the string that the caller is passing in? Why not alter it in the "real" constructor? If it's meant to be a flag, maybe you need yet another constructor to pass in what you really want...? -ner
  11. Glad you didn't mention Dodge. My first "new" car was a Dodge Neon (back in '95, first year they came out). It worked great for me, no problems. After 5 years I sold it to get a Civic and BAM! when I saw the resale value I knew I had something to learn about cars :) -ner
  12. I think by "timestamp" you mean a Date/Time column, right? A timestamp in SQL Server is a special type of column that doesn't really contain a date/time, but just a time "stamp" - a hex/binary value. If you really mean a Date/Time value, then your filter should work just fine. I tried various tests and they all seemed to work. For example, I used: '8/17/2004 11pm' '8/17/2004 23:00:00' '2004/8/17 11pm' '2004/08/17 11pm' '2004/08/17 23:00:00' It's possible that your local machine and the SQL Server on a different timezone. If so, your time portion may be off by an hour or more from what you think it is... or maybe it's not right on the hour, but has some minutes, seconds, etc. in it. -ner
  13. @Malfunction: I read some of that review - he talks a LOT about bugs, but doesn't mention a single one that he saw. He claims VSS can't have multiple developers check-out a file at the same time and that is simply not true. My shop currently uses VSS and I've used it for probably 6 or 7 years without EVER having a problem - no sudden crashes, no corrupt databases, nothing. I won't argue that I've heard others say they've had problems, but I've never come across a problem. As for multiple check-outs, VSS does them pretty well. It provides a very nice merge function (visual of course) which works about 90% of the time. I'd say 100%, but for controls on WinForms. For some reason, if two developers have a file checked out and are tweaking controls (adding, removing, or renaming) the merge shows conflicts that must be resolved. For pretty much ALL other code, I've never had a merge problem. The merge problem with controls can be easily spot-checked before check-in through the "Merge Conflict" window. This is not to say VSS is not without problems. VSS, like most other source control systems from what I've heard (dreaded rumors), doesn't work well when you rename or move a file in Visual Studio. Meaning, VSS won't really delete the old file on a rename, it just makes a copy. You have to remember to go delete the file from sourcesafe manually. It's backup/restore process also takes a LONG time, even for relatively small databases. The branching/merging feature is nice but doesn't work well if you want to be able to do a "temporary" branch and merge later. The new version of VSS is supposed to help with this, but I haven't tried it. Also, he's right that you can only "see" files are available on your network. It doesn't use a protocol, such as http, to see files on the internet. I've personally never had a problem with this. It could very well be an issue if you have developers that are far away and you don't provide a VPN connection. I'd think you'd at least want to setup an HTTPS server (secure web server) if you wanted to expose your company's files over the internet and that seems harder than a VPN, but that's just my simplified view. As a note about that review Malfunction pointed to - he claims to have reviewed VSS 7.0. At the time of his review (Jan '04) that was likely in an alpha or early beta stage - if it was released at all. He mentions the version numerous times so I don't think it was a typo. The new version of sourcesafe isn't even called SourceSafe - it's TeamShare (I think). I would guess he reviewed version 6x from his comments but if so, he hasn't used it THAT extensively. As I mentioned, he claims certain things that are just wrong. Darn, my "review" was almost as big as his :) -ner
  14. More of what you don't want to hear... You should definitely be using some kind of a source control system. See this thread for a discussion. Since you're distributing software to users there's no good reason NOT to have things under source control. The source control allows you to "label" or "mark" a version so that when something like this happens, you can get back to where you were. You might try decompiling the source but I would guess that you'll end up having to tweak your existing code anyway - you wouldn't want to work off the decompiled source. With that in mind, you're probably going to end up figuring out what you changed and change it back manually. Good Luck! If it helps, I feel for you - been right where you are with a couple of "home" projects before I started using source control on *everything*, even (and especially) test projects. -ner
  15. Will an Identity not work for you? Typically you will do something like this: -- Begin a tran and update so that you lock the table BEGIN TRAN -- Assumes only one row UPDATE tblTest SET myColID = MAX(myColID) + 1 -- Get the value into a variable - a pure SELECT will work fine too SELECT @SomeVar = MAX(myColID) FROM tblTest COMMIT TRAN -nerseus
  16. VSS versions don't really have anything to do with other file versions (DLLs, VS projects, Word files, etc.). The version in VSS is just sequential - the first time a file goes in, it's version "1". The next check-in is version "2", etc. Unless something is recognized as "text", VSS won't give you the ability to compare versions or see differences. Luckily, most MS Office files have their own internal ability to track changes. You can turn that on in Word, for example. Through Word you can View the changes visually or clear the change history. As for backing up files, VSS has backup/restore tools but they're far from perfect. VSS was meant to store any kind of file, keep track of its history, and "label" versions of files. Again, a version being VSS's version. If your project is 2.0 then you would have to name the label something like "Ver 2.0". The "2" version number won't really be anything that VSS shows or recognizes. VSS is ideal if you're a Visual Studio developer as it gives you the ability to check in and out from within the IDE and it's "smart" about the files it checks out. I can't speak for other source control systems but I would guess that many support Visual Studio as it's one of the more popular development environments. I've been reading some *really* cool things about the new source safe that's due out with the new .NET. I hope they fix a couple of the more glaring issues with the current sourcesafe. -ner
  17. Check out this thread. -ner
  18. In the past, a label wasn't a true control - they didn't have window handles for example. In Windows terms, a label *used* to be just something the compiler drew for you. But now that labels have window handles, I assume they're a lot more "intense" than they used to be. Meaning, they're taking up GDI resources (window handles). In general, a textbox would probably be handling a lot more windows messages as well, even if YOUR code doesn't use them. I wouldn't let that sway you too much. In general think of it like this "if I can use a label, use a label". Only if the label doesn't give you what you want should you use the textbox. -ner
  19. I created a table just like yours (3 columns, same types, etc.) and put in the same data as you but I get a different sort. Mine shows what I think you want: select * from cm order by sortmail Account MailName SortMail ----------- -------------------------------------------------- -------------------------------------------------- 10 -123 -123 12 -123 -123 11 .123 .123 3 123-456 123-456 4 123.456 123.456 2 123456789- 123456789- 1 123456789. 123456789. 6 My Company Co-Ames My Company Co-Ames 8 My Company Co-Ames My Company Co-Ames 5 My Company Co. My Company Co. 9 My Company Co. My Company Co. 7 My Company Co. Ames My Company Co. Ames In other words, dashes before periods in every case. This was on a default SQL Server 2000 install with a table created through the GUI (default collation). You can also specify a collation per column - if you use Enterprise manager, go to design table and click on each varchar column. It should say "<database default>". I think if you import tables through DTS that it assigns a different collation. Might be worth checking... -ner
  20. Just to be clear: When you run your queries, are you using an ORDER BY clause? If you're just selecting rows or viewing them in Access's table view, there's no guarantee on how those records will sort. -ner
  21. Also note that the Replace method only returns the modified string, it does not update the original. So the following will NOT work: Dim myString AsString = "Stuff" myString.Replace(OldText, NewText) You should do this instead: Dim myString AsString = "Stuff" myString = myString.Replace(OldText, NewText) -ner
  22. Sounds like you don't want a console application :) If your code is already setup, simply change the project property from Console Application to Windows Executable. -ner
  23. You have to add a WebBrowser control. It works pretty much the same way, drag and drop, set the URL (or NavigateUrl or something like that). The control is not in the toolbox by default but you can add it by right clicking the toolbox and selecting "Customize...". -ner
  24. You've come across VB's little "trick" of typecasting a variable. The & after a variable indicates it should be a Long (or Integer, I can't remember). Obviously not what you want on a string variable. Some extra whitespace should fix it up nicely, as Heiko pointed out. -nerseus
  25. I'm confused what the problem is... First, you have the ASCII values backwards: a dash is 45 a period is 46. Based on ascii codes, I'd expect the dash to sort first assuming an Order By with "ASC" for ascending. This is what you said VisData does and is correct. This is also what you said .NET does - doesn't that mean it's correct? Or, are you asking to fix the ADO Recordset's sort, which appears to be off? -nerseus
×
×
  • Create New...