Jump to content
Xtreme .Net Talk

kejpa

Avatar/Signature
  • Posts

    321
  • Joined

  • Last visited

Everything posted by kejpa

  1. Hi, have you tried to change the * to a % In my experience it has made a difference in some cases. % is the standardSQL wildcard token, M$ took what you use in DOS and used it within Access to "help" people. * is standardSQL token for "all fields" as in select * from Names HTH /Kejpa
  2. Hi, From my point of view the only time it will be problem is if you insert/update the database using string concatenations. If you use parameters inserts/updates will be so much easier. IMHO /Kejpa
  3. Maybe MySQL for VB will help you get started. HTH /Kejpa
  4. Hi! Use the sleep function of the Thread object, Threading.Thread.Sleep, I think, I don't have VS up right now... HTH /Kejpa
  5. As I told my old students who thought they were "A" students... "Merely asking why you didn't get an A is reason enough for not giving you one" ;)
  6. Hey! Subselects are beautiful in their compexity, but most of the time not necessarry. This is AFAIK one of these times... # Psuedo code SELECT items.path FROM items, tags WHERE items.tags LIKE "%" + tags.id + "%" and tags.name='one' I might be wrong, it's easier if we get to see the actual code... HTH /Kejpa
  7. Sorry, I was too quick in my assumptions :o The reason is in your code... Dc = New OleDbCommand("Select * from Groups where GroupName<>null order by name asc") when dealing with null you need to use is and is not like this Dc = New OleDbCommand("Select * from Groups where GroupName [i][u]is not[/u][/i] null order by name asc") HTH /Kejpa
  8. Sounds like you're run into a common problem, the name of the table is a reserved word... Change the name of the table and try again. HTH /Kejpa
  9. Isn't J++ and C++ enough?!??! ;) But you've got the short hand i += 10 that increments i with 10 /Kejpa
  10. 'tis the time of the year when you're eagerly looking forward to getting them from your bunny, but are there any known in .NET? /Kejpa
  11. Command/Response -revisited... Hi, I was sooo happy yesterday when I got it tweaked into my existing CommPort class. But today I realize that I need the response in the statements following the call :( 'UI try sResponse=myCommPort.CmdResponse(sCommand) select case sResponse case "<" DoThis case "!" DoThat case "?" DoSomethingElse end select catch ex as TimeOutException console.writeline(ex.message) end try Asynchonous handling comes to mind, but I can't find any good samples. The UI calls once a second and the calls should pile up but if no respose has come within 1.5 sec it should timeout and process next message not that has not timed out. The message queue was pretty but I couldn't get the response back to the calling method :( TIA /Kejpa
  12. Hi mskeel! I've got it working now, thanks to you. With some tweaking I got it into my existing Comm-wrapper too so now I'm really pleased. /Kejpa :D
  13. Hi! The problem is that I probably will have a couple of different classes all with a couple of instances that will use the call. With event handlers I'd have the response in half a dozen places it shouldn't be. Is passing a delegate a way to ensure that only the calling object will receive the response? Many thanx! /Kejpa
  14. Hi, I'm using a derived Serialports class for handling all talking/listening on a Serialport. This class is referenced from a number of other classes. What I basically want is that it handles each call separately, send a command, wait for a respose the given time and return the response or a timeout exception. If another object is trying to talk during this time it's put on hold, and if the second objects Write timeout time is reached while on hold it will get a TimeOutException too. One thing that complicates it is that the application have to move on as if no waiting is done. Another thing is I want it simple... try sResponse=myCommPort.CommandResponse(sCommand) catch ex as TimeOutException Debug.Print"Timed out" catch ex as Exception Stop end try Any help appreciated /Kejpa
  15. There is a test at.... Swedish Post and Tele Direction (it's all in Swedish :() Might help you /Kejpa
  16. You're soo close.... Datatype mismatch, you're assigning an integer field with at string since you enclose nPlayer in quotes, try oDB.Write("UPDATE [Players] SET [Players] = '" + sPlayerName + "' WHERE [iD] = " + nPlayer ); HTH /Kejpa
  17. Hi, I want to make sure that my trace.Writeline's are properly written to my trace file and so I created a Threading.Timer like... _trdStreamFlusher = New Threading.Timer(AddressOf StreamFlusher, _Stream, 10000, 10000) ' -Snip- Private Shared Sub StreamFlusher(ByVal file As Object) Dim oStream As IO.FileStream = DirectCast(file, IO.FileStream) Try oStream.Flush() Catch ex As Exception Console.WriteLine(ex.Message) End Try End Sub but the file don't contain all my trace information :( Any ideas? TIA /Kejpa
  18. Standard answer... Use Parameters instead of parsing a string. Safer and more robust HTH /Kejpa
  19. Yes, that's what I needed, and thought that I had tried. I almost made a wise-guy remark of it but decided to give it one more shot. Thank you, now I'm officially todays Fool-of-the-day. /Kejpa
  20. Hi, I'd like to convert a enum value to it's string representation. It's easy if it's a value within the enum, the problem I'm up against is that it's a combination of values.... <Flags()> Public Enum eGraphType As Integer gtNone = 0 gtLine = 1 gtArea = 2 gtIndicator = 4 gtRadar = 8 gtPolar = 16 End Enum if I have myGraph = 7 I can see in the local window myGraph - gtLine, gtArea, gtIndication {7} How can I get this into a string variable?!? Dim myString as string=myGraph TIA /Kejpa
  21. converting from double to integer automatically rounds the value according to the regional settings rules. Use Math.floor instead which gives you the right answer. Dim dblamount As Double = Val("10.51") Dim dollars As Integer = Math.Floor(dblamount) Dim remainder As Double = dblamount - dollars Dim quarters As Integer = Math.Floor(remainder / 0.25) remainder = remainder - quarters * 0.25 Dim daims As Integer = Math.Floor(remainder / 0.1) remainder = CInt((remainder - daims * 0.1) / 0.01) Console.WriteLine("{0}$ {1}q {2}d {3}p", dollars, quarters, daims, remainder) Works swell both with 10.25,10.51 and 10.35 /Kejpa
  22. 25/25 = 1 , remainder is 0 35/25 = 1 remainder is 10 The mod operator gives you the remainder not the number of quarters. /Kejpa
  23. You shouldn't use 'mod' to find out the number of quarters, mod gives you the remainder and that's 0 if you divide 25 by 25. You should use the whole-part as the number of quarters and keep the remainders for the daims. dblamount=val(txtinput.text) dollars=math.floor(dblamount) remainder=dblamount-dollars quarters=math.floor(remainder/0.25) remainder=remainder-quarters*0.25 daims=math.floor(remainder/0.10) remainder=remainder-daims*0.10 HTH /Kejpa
  24. Hi! I've read the pages and I can't find out how to get by without hardcoding in the object assignment. /Kejpa
×
×
  • Create New...