Jump to content
Xtreme .Net Talk

kejpa

Avatar/Signature
  • Posts

    321
  • Joined

  • Last visited

Everything posted by kejpa

  1. What sort of data types do you need?!? I've never encountered any data type that isn't supported /Kejpa
  2. Active Reports is great, I've used it and it works swell. Both with SQL and non SQL bound reports. Currently I'm looking at ComponentOne's alternative, in order to cut back on the number of 3rd party controls we've decided to try ComponentOne's .NET Studio suite. My 2c... /Kejpa
  3. Hi, I'll make a quick try... SQL injection is when you insert a string that completely changes the sql statement. Consider... sSQL="Select * from Employee where manager='" & sYourID & "'" Normally sYourID would contain your employee ID (say... ab123) and in a form or webpage you're supposed to enter it to see who you're supposed to manage (when logging in or somehow else) Now, if you change the variable sYourID to contain ab123' or 'a'='a the SQL statement suddenly becomes Select * from Employee where manager='ab123' or 'a'='a' which returns all rows since 'a' always equals 'a'. It's even more interesting to use db specific functions in what you inject.... If you could have sYourID to contain ab123' or drop table Login or 'a'='a the table Login might get dropped. And that's not too fun. If you use parametrized queries you assign the string to a variable that encapsulates (and escapes) the string into one string which means that the first injection statement would get parsed as Select * from Employee where manager='ab123\' or \'a\'=\'a' (assuming \ is the escape characted) the databse would then look for that manager ID and it wouldn't be found and no rows would be returned. Soooo, the bottom line. If you have direct user interaction with your SQL, use parameters (or check terribly THOROUGHLY). It's a lot safer but you can't see the actual SQL anywhere in your IDE or when you print the SQL HTH /Kejpa
  4. Hi, all you hear of is how terrific XML is. I must admit that I'm not all convinced, so you better show me how simple it is ;) I have a file (config-file actually) where I want to change a value from 15 to 31. With the ancient old ini files you could just say what section and key and it was all done. How do you do it with the new fancy xml config files? The node I want to change is... /configuration/system.diagnostics/switches/add and there are a few with the same name but with different "name" attribute Looking forward to the simplicity of XML... /Kejpa
  5. So does your first approach with UNION... Having it in columns like ----------------------------------- Sales | January | February Cars | 5 | 10 Boats | 10 | 7 Planes | 15 | 1 ----------------------------------- Requires a heavy (and complicatly beuatiful) subselect, not too sure that's what you're after ;) Just because your data is in rows and not columns doesn't necessarily mean that in your UI you must show it in rows, you can always transform it into columns... HTH /Kejpa
  6. Be cultural... Hi! Make your own Culture... Sub Main ... Application.CurrentCulture = MyCulture() ... End Suub Private Function MyCulture() As System.Globalization.CultureInfo Dim ciMy As System.Globalization.CultureInfo = System.Globalization.CultureInfo.CreateSpecificCulture("") ciMy.DateTimeFormat.ShortDatePattern = "yyyy-MM-dd" ciMy.NumberFormat.NegativeSign = "-" ciMy.NumberFormat.NumberDecimalDigits = 2 ciMy.NumberFormat.NumberDecimalSeparator = "." ciMy.NumberFormat.NumberGroupSeparator = "" ciMy.NumberFormat.NumberGroupSizes = New Integer() {0} ciMy.NumberFormat.PercentDecimalDigits = 2 ciMy.NumberFormat.PercentDecimalSeparator = "." ciMy.NumberFormat.PercentGroupSeparator = "" ciMy.NumberFormat.PercentGroupSizes = New Integer() {0} Return ciMy End Function Then you're pretty sure that you'll get things displayed as you like it nb. There are some ancient VB methods/functions that still default to en-us but you'll find them soon enough. HTH /Kejpa
  7. Hi, you can't have a datagrid be updated from an external thread. You have to use invoke in some mystrious way. I'm told and convinced. I have never got it to work though so I have either removed the thread that messes with the datatable (and use a timer instead) or the grid that shows the values (and use a listview instead). Not much of a solution, but some kind of work around at least ;) HTH /Kejpa
  8. Aouch! Have a look at GroupBy SELECT NumCarsSold,NumBoatsSold,NumPlanesSold, Month(RecordDate) FROM Sales group by month(RecordDate) where Year(RecordDate)=2004 (Not totally sure that Month() and Year() is working functions in your database though...) HTH Kejpa
  9. Sounds like you're using an Access database. For some mystrious and obscure reason text fields in Access have two properties that (in my sense) have conflicting behaviour. AllowNull which defaults to true and AllowZeroLength which defaults to false.... I've always thought that null values have zero length, but I guess the makers of Access disagree. Anyway, if you have access to the database, set AllowZeroLength to true for the indicated textfield, there is a way of doing it codewise too but I dare not to type how since I've only done it once or twice a couple of employers ago. HTH Kejpa
  10. And I forgot.... Be patient, in Whidbey (VS2005) the sort order in the form is back I'm currently doing most things with VB2005 Beta 1 and I'm sooooo happy :D /Kejpa
  11. prmUPDID.Value = DBNull.Value HTH /Kejpa
  12. Hey! In the properties window you can change the view and see the events of each form object. You can from there choose which event you want to work on. The properties window is still sorted alphabetically. Not exactly what you're looking for but I feel safer passing the tower square ;) /Kejpa
  13. Hi, First of all, which line is the one producing the exception? That's where you should start searching for something wrong. Secondly, You're executing a query which don't yield any resulting rows, I wouldn't have used a DataReader to insert records. I'd use a OleDbCommand object... HTH /Kejpa
  14. That's a simple one. :o Thanksalot /Kejpa
  15. Hi, How can I detect if the Shift button is pressed when handling a button click event? Is it stated somewhere in the EventArgs parameter or do I have to have a form variable that contains which buttons (Shift/Ctrl/Alt) that currently are pressed? TIA /Kejpa
  16. No, you have to start your form from a Sub Main if you want global error handling. HTH /Kejpa
  17. Hi guys! Anyone know of a charting component that's working with the VS2005 beta? I've tried some that works in vb6 and some that works with VS2002/3 but none of them will do in 2005. I know it's not the right forum, but hey, it's worth a try.... TIA /Kejpa
  18. I'd gladly do! How do I get the week number by using the properties of the date? /Kejpa
  19. Found it! DatePart(DateInterval.WeekOfYear, dtTest) is using FirstWeekOfYear.Jan1 and FirstDayOfWeek.Sunday as default values regardless of your local settings. In order to have them localized (why is MS using Globalization for localizing an app :confused: ) you have to write DatePart(DateInterval.WeekOfYear, dtTest,FirstDayOfWeek.System,FirstWeekOfYear.System) That's rude. /Kejpa
  20. Of course all databases would need to have the same structure, the trouble is keeping that structure for all the databases. And yes, failing to keeping them in the same structure is a nightmare. Trust me, been there, done that, will not do the same mistakes again... Still, it's the safest way to keep data separated. You have a login/pwd combination that will return your dbname in a session variable (or what you call it in .NET) and use that variable in your connection string. It's not that hard. If you make different SQL server users and revoke all rights to all databases except for their own then you're pretty sure they can't get other customers data. It's even a setup that the customers agree on is safe, and a lot easier to explain to them compared to "We will remember to include your UserID everytime we seach the tables..." But, maintenance is A LOT higher. (But you can make money out of that too ;)) IMHO /Kejpa
  21. Hold your horses! No! *panic* No 4 days weeks!!! I'd be better off with 10 days weeks, might keep the deadline then ;) Alright, back on topic. The week number of any specific date depends on which day is defined as your FirstDayOfWeek, some countries have Sunday, some Monday (and there might be others too) Another thing that the week number depends on is which week of the year that is defined as 1. Again different countries have different standards (btw Standards are great, everyone should have his...) some countries say that the week that contains Jan 1 is week 1. Some others say the first whole week is week 1, yet others say that the first week of the year containing at least 4 days is week 1. In 2005 this will bring problems to which week a date such as Jan 30 is in. Where I live Jan 30 is in week 4. (Mon is FirstDayOfWeek, first week has at least 4 days) In some countries it's week 5 (Mon is FirstDayOfWeek, Jan 1 is in week 1) In some countries it's week 6 (Sun is FirstDayOfWeek, Jan 1 is in week 1) How are we supposed to communicate which week we will deliver if there's such a big difference in the numbering of weeks?!?! Now, back to my Q. Why isn't these settings affecting what week number is returned from DatePart(DateInterval.WeekOfYear, "2005-01-30") /Kejpa
  22. Hi, I've bumped into some strange behaviour when trying to set the localization of my app. I want it to have Monday as the first day of week and the first 4 day-week as week # 1. However, Jan 1 is always week 1 in VB ... Not in my calendar, next year for instance it's week 53 (of this year) Jan 31 1999 is interesting. With my settings it would be week 4, but VB reports it as week 6 (which it will be if Jan1 is in week1 and Sunday is the first day of the week) Doesn't the settings of FirstDayOfWeek and CalendarWeekRule have any affect?!? Puzzled! /Kejpa
  23. That's a tricky one. I've done both and both have their own benefits and drawbacks. When it comes to security haveing many different databases where each customer has his own and only access to that one is unbeatable. But manageing the 100 databases we had wasn't fun. Our reason for separating them was that the customers demanded it. The data was sensitive and just a possibility that one client could see the others data was out of the question. Many databases have some performance advantages too, but if you index properly that will not be a reason for separating them (IMHO) So, the bottom line. IF you're a bummer for security do multiple databases, but prepare for a _major_ service account, otherwise stick to one big database. HTH /Kejpa
×
×
  • Create New...