Jump to content
Xtreme .Net Talk

Nerseus

*Experts*
  • Posts

    2607
  • Joined

  • Last visited

Everything posted by Nerseus

  1. In most cases, VBScript doesn't have the global constants that VB has. You probably have to define NO_ACCESS yourself or find it in a global enum (if on exists). Start with the following link to find out what's available: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/vtorivbscript.asp -ner
  2. First take a look at this: http://msdn.microsoft.com/vstudio/express/support/faq/ Then take a gander at this: http://xtremedotnettalk.com/showthread.php?t=94701 -ner
  3. If your table has only one row, then just UPDATE without using a WHERE clause at all. That will UPDATE every row in the table, in your case just one. -ner
  4. The square brackets are to surround names of types or variables in case they are named after a reserved word. For example, if you wanted a variable named Dim, the following wouldn't compile: Dim Dim As String = "hello" But this would: Dim [Dim] As String = "hello" Same goes for types. If you wanted, you could declare a new class: Public Class [Dim] Public [For] As String = "hello" End Class It's there if you needed it, but I think most people would call you crazy for doing this on purpose :) -nerseus
  5. Maybe investigate the reports built into Access? I have never used them, I only know that they exist. You could also try something simple, like exports to Excel? Crystal isn't that hard either, if you've used them before. But the learning curve, including getting something into a user's hands, might be too large. -ner
  6. To elaborate on PD's comment, rather than have a generic DoSomething(object) function, you might want to define an interface like IDoSomething (reading that afterwards, it sounds funny - "I do something" - nevermind). IDoSomething would define a method, DoSomething. Then you would have code like (C#): ((IDoSomething)o).DoSomething(); Not sure of the syntax in VB.NET, mabye: DirectCast(o As IDoSomething).DoSomething() The idea is to cast your object as the interface IDoSomething and then call the method. Let each type of object handle the DoSomething method however it wants to. -ner
  7. If this is a readonly grid, I generally have the SQL engine do the transposing for me. It generally makes sense since the lookup/replacement of A for Active is stored in a table anyway. If it's not and this is a hard-coded thing, you might still use SQL to do it with a CASE statement (SQL Server only maybe). If the above won't work then I like your option - defining a relationship and having it display "automatically". Another option might be an expression column that does the replace. Or, what I've done when all else fails, manually add another column to the DataSet in code and populate manually AFTER getting data from the DB. This gives you the most control. -ner
  8. You may try asking on a Windows forum as well - something about how to log what windows is doing while "starting up". I don't much about Windows startup, but I'd bet that there is some way to log what it's doing, or what it's trying to do. One last question - any chance you had a beta copy of Visual Studio installed? I know the manual deinstallation instructions are huge. I wonder if something got leftover and is causing some kind of conflict? I worry because I still have beta 2 at home but have the DVD of the full 2005 ready to test with :) Let us know what you find out! Who knows when it could happen again? -ner
  9. Did you install everything for VS2005? Maybe you have a slower box that's now trying to run IIS and SQL Server, for example? Did you install any of the new Team System? Check a couple of things, these are mostly generic: 1. Run msconfig (just Start->Run) and go to the Startup tab. Make sure you only have checked what you want. 2. Go to the services tab of msconfig or just open the Services component through Start->Programs->Administrative Tools. Look for anything that's running now or marked "Automatic". Make sure they're components you want. If you're not sure then now might be a good time to start peeking :) Five minutes seems quite excessive for a Windows Startup. I wouldn't be surprised at 5 minutes if you are running Windows 2000 Advanced Server (not a development OS anyway), but a standard Windows XP with VS 2005 shouldn't take that long. -ner
  10. My guess at MS releasing a free IDE? To get the product into schools. I had to buy two compilers in school, each about $99 for student pricing. If there are free IDE's out there and MS doesn't have one then students (and their teachers) are likely to use the free ones and get used to that. Now that MS has a free IDE, and a nice one at that, students are more likely to use it and want to continue to use it when they get out of school. MS is probably betting that it will help cut down on the MS bashing as well ("Unix and shell are COOL, M$ sux0rs", "Mono rocks, and it's FREE"). I would guess that the majority of .NET developers use Visual Studio. It would certainly be a plus, albeit small, if a developer I wanted to hire anyway already knew Visual Studio. -ner
  11. Try creating a new, empty project and adding all of the source files back by hand? I just downloaded the gold copy of VS 2005 but haven't tried loading any beta projects yet. -ner
  12. In SQL Server? I use CONVERT. For example, to convert a date to US standard: SELECT CONVERT(varchar, [datecolumnname], 101) [newDateColumnName] FROM... You can also use CAST, I believe. Formatting is limited, but usually gets you what you want. -ner
  13. You can use the .Select method of the DataTable to get a list of matching rows (a filter). You can also use a DataView to do the same filtering. Unfortunately, DISTINCT is not a keyword that's supported. The filtering represents mostly what you'd see in a WHERE clause such as "col = 'abc' and col2 < 5". Any type of duplicate matching will have to be done manually. You can also use the .Compute method to get aggregates, like MIN, MAX, SUM, etc. but that still won't help you get distinct rows. -nerseus
  14. From a webserver, you can stream a PDF. You'll have to work out how to convert your blob into a Byte array, but that shouldn't be hard. Then do this: Response.ContentType = "application/pdf"; byte[] document = GetPDFDocument(); Response.BinaryWrite(document); Response.End(); When the user goes to your aspx page, it will open in Adobe reader, usually within the browser. The user has the option (clientside) to force Adobe to always open by itself (not in a browser). The above code will still work, it just won't open in a browser. That's a user preference, so there's nothing you can do about it. This is how I've streamed PDFs. As with anything, I'm sure there are other ways to do it. -ner
  15. Try: SP_Search 'm.[description] like ''bird%'' ' You need to double up the single quotes inside of quotes. To test future strings, use SELECT on your string to show what it is. For example: Create Proc SP_Search @WClause varchar(1000) as DECLARE @sql varchar(1000) SET @sql = 'select distinct m.idmedia, m.idcampaign, m.[description] from Media m, keywords k where m.idmedia=k.idmedia AND (''' + @WClause + ''') ' SELECT @sql -- exec (@sql) I commented out the exec line so you can test the string. I suspect you're still going to have a problem since your "exec" line is wrapping @WClause with single quotes. I can't say this loud enough, but [highlight]you really, REALLY should be using parameters for dynamic SQL in SQL Server[/highlight]. Look up the proc sp_executesql for a start. It will give samples on how to do dynamic SQL properly. It may be a bit of a learning curve, but not more than an hour or two to get it working. That's certainly faster than debugging a custom dynamic SQL solution, which is also more likely to be buggy. -ner
  16. My limited experience has shown two issues with dates. Parsing a string and sending a date to a database. When parsing or displaying a string, I like to use the built in functions such as ToShortDateTimeString or other methods of a DateTime variable. I would expect DateTime.Parse () to use the current culture so I usually "don't have to worry about it". On the other hand, when sending things to a database - I use SQL Server mostly - the DB wants a date in one format. From my installs, that's always in the US format (month/day/year) though that may be an option. So, you're line of code "strTime = strMonth & "/" & strDay & "/" & strYear" I would not use unless I was passing that date to SQL server as a string. I wouldn't trust a hard-coded format to work with DateTime.Parse() because of the very reasons you mention. I mention DateTime.Parse but it's more or less the same as CDate, but more .NET oriented than the old VB function. -ner
  17. Try: myObject = myCollection(intPK) You'll likely have to cast the object coming out to whatever type myObject is. If it's a class called WhateverFun, then: myObject = DirectCast(myCollection(intPK), WhateverFun) I'm not a VB guy, so the params to DirectCast may be backwards. -ner
  18. If I interpret your sample data right, you have keywords all grouped together, so that one row of data has the value "forest wood elf green"? That seems like a bad design. But you can still make your query work, it just won't be as effecient or as accurate. You'll need to parse the text entered by the user into separate strings and then build multiple LIKE statements. So if they enter 'forest city bird', you have to break that into 'forest', 'city' and 'bird'. Here's some sample code: string fullSearchString = "forest city bird"; string[] searchStrings = fullSearchString.Split(" "); You'll probably want something more robust than "Split", to remove two spaces and etc. - I leave that up to you. Now build your WHERE clause to look like this: ...WHERE i.idimage=k.idimage AND (k.keyword like '%forest%' and k.keyword LIKE '%city%' AND k.keyword LIKE '%bird%') That would use an 'AND' join - all keywords must be present in a single file. If you want an 'OR' join, change the ANDs to ORs inside the parens above. The ineffeciency comes from doing a LIKE with a wildcard on the front, as in '%forest%'. It's much more efficient to just put one on the end, as in 'forest%'. Or, if you require exact matching, then put the keywords in the table one at a time. If that's possible, just ask and we can help. -ner
  19. If you really need to remove something from the middle, maybe try an ArrayList. You can get to the last item easily and let's you remove from the middle. Both Stack and ArrayList should be pretty lightweight. -ner
  20. I'm still not sure what you're trying to do with the collection where an Index would matter. To me, index only has meaning in an array where an item has a known index. The Collection class can reference the items by key or index but the index works just like an array. Meaning, if you have index 1 , 2 and 3 and remove index 1, the others will shift down. Maybe you could show some code of what you want to accomplish and we could make a recommendation. You have mentioned the "order" of items in the collection a few times. I wonder if you're concerned about the index-based order or a sorting order? If you want a sorted list, use the class called SortedList, part of the System.Collections namespace. If you want the indexes to not shift around, you're mostly out of luck unless you keep track of an index inside of your object, as a property of the object you put into the collection. -ner
  21. I'm not sure what Index you're talking about. There are many collection types, such as a Hashtable or ArrayList or SortedList. These usually have a key instead of an index. If you're using ArrayList and have 3 items (0, 1, and 2) and you remove item 1, you will only have items 0 and 1 leftover. In other words, the items in the array shift down -- but there's no index about which to worry. -ner
  22. A customer routine is what we use at work - loops through a SqlParam collection and creates a custom set of name/value pairs. We use it for debugging and it works well enough. The SQL Engine DOES eventually get the parameters passed as a human-readable string. If you use SQL Profiler you can see the "exec proc @param='value'" type of call. If you don't like the custom code solution, you may look into intercepting that string and saving it somewhere. If the Profiler can see the string before it's executed, there's a high probability that something exists for you to "hook" into that stream. Good luck! -ner
  23. @samsmithnz: MS recommends only keeping a connection open as long as you need it for multi-user applications, mostly those accessed through a common server - usually a webserver. MS Access is primarly single user. I would never open/close a connection on every query to Access. If you have a multi-user application, MS now recommends MSDE over Access. -ner
  24. I'm 33 - the original picture was taken about 1.5 years ago, pre-goatee. If you follow the nerseus link above, you'll see a second photo, slightly newer. I look considerably older with a goatee, probably why my wife likes it so much. Maybe that will bring me closer to DiverDan? :p -ner
  25. I missed this topic, somehow. Arizona, USA Originally from Austria (no Australia) - so watch for my stubborness (and my goulash). -ner
×
×
  • Create New...