Actually this is not your fault, MySQL reader transforms TINYINT to BOOL by default. In order to prevent this, you need to add the following line to you connection string: "Treat Tiny As Boolean = false". Just by doing this, TINYINT will be treated as a numeric value :)
Gonzalo Cao
Posts
-
C# MySQL Question -
custom control problem in design timeThe response you've got before is going to work, anyhow I think that you need to know why this won't work. Thing is that DefaultValue, prevents the form's designer from generating code for this property. So when you set the property as true, no value is generated and bool variables always initialize to false. That's what's giving you trouble.
-
Problem wih UDP connectionsHi all, I've got an strange problem with UDP communication which I can't explain. First of all let's explain the situation: We have some access control terminals that store the movements of the staff, this devices are connected via ethernet and send this movements through port 4370, using UDP. To link with these devices we have an application that can be installed as a service which periodically downloads the data from them and inserts the data into the database, besides that we have an application for the end user that links to the database and in case of need is able to link with the devices as well. At first we installed both applications in a Windows XP machine and it worked perfectly fine, but after sometime we decided to move the first application to a server and this is when trouble showed up; for some reason it seems the application is unable to connect with any of the devices, but all of them are reachable via ping, telnet and web. And to make things worse I installed the end user application in this server and it connects without any problem. I don't know if this is the right place to post these, but if anyone can give me some tip I'd be most grateful. Best regards.
-
ToolStripMenuItem.Visible always returns false?I don't think this is the problem, but just in case: If you check the value on step by step debug the value will always be false, since the window is hidden by visual studio.
-
How to convert any object to byte[] without marking it Serializable or DataContract?Were you able to fix it?? With the sample code you've posted I was not able to find the problem.
-
How to convert any object to byte[] without marking it Serializable or DataContract?You welcome. Good luck with you project.
-
How to convert any object to byte[] without marking it Serializable or DataContract?public static object RawDeserialize(byte[] rawdatas, Type anytype)
{
int rawsize = Marshal.SizeOf(anytype);if (rawsize != rawdatas.Length) { return null; } IntPtr buffer = Marshal.AllocHGlobal(rawsize); Marshal.Copy(rawdatas, 0, buffer, rawsize); object retobj = Marshal.PtrToStructure(buffer, anytype); Marshal.FreeHGlobal(buffer); return retobj; }
Here it is :)
-
character postion replacemenetpublic void RelocateChar(ref string text, int pos1, int pos2)
{
char[] supportArray = text.ToCharArray();
char supportChar;supportChar = supportArray[pos2];
supportArray[pos2] = supportArray[pos1];
supportArray[pos1] = supportChar;
text = new string(supportArray);
}Maybe there are better solutions, but this one should work.
-
How to convert any object to byte[] without marking it Serializable or DataContract?Hi, I do this and it works for me. public byte[] RawSerialize(object item, Type anyType) { int structSize = Marshal.SizeOf(item); IntPtr ptr = Marshal.AllocHGlobal(structSize); Marshal.StructureToPtr(item, ptr, true); byte[] bff = new byte[structSize]; Marshal.Copy(ptr, bff, 0, structSize); Marshal.FreeHGlobal(ptr); return bff; }
-
Call a function from a dynamically loaded C dll [Answered]Thank you :)
-
Call a function from a dynamically loaded C dll [Answered]Ok, now, that's an answer :). And now here's a question, what if SomeMethod's signatures does not match the delegate signature?? Do I get an ArgumentException?? I know this should be a problem since he knows the signature of the method. Just asking out of curiosity.
-
Call a function from a dynamically loaded C dll [Answered]I don't know if you have better ways to do this, but one idea is to declare them all and after that you define a Delegate with the same signature. This way you can assign the corresponding function to the delegate, this way you got pretty much the same functionality that you get with pointers to functions.
-
How to add multiple components (texboxes,compoboxbutton etc...) to a listviewIf you working with windows forms you can check the XPTable article here in codeproject. It can fit you requirements. If not you can create your own Listview, since default one is not editable.
-
To use or not to use worker thread in Windows Service?Touche!! And that's why my mamma told me I need to read the question before giving an answer :$
-
To use or not to use worker thread in Windows Service?I mostly use threads, and if you want to keep the periodicity logic apart from the rest of the logic you can use something similar to this: while(true) { DoStuff(); sleep(1000); } The good thing about this, is that you running this code through a separate thread; thus it does not interfere with the UI thread. On large processes this will save you a lot of problems with the application not responding or working slower than expected. Anyway as someone else told you both solutions could work, I'd use timer for trivial tasks and the thread worker for more complex stuff, but that's just my choice.
-
Remote desktop server/clienthi, It's not that I'm try to be mean, but you shouldn't ask such wide questions. Get some information, start your project and if you stuck in some point maybe someone can help you.
-
Display messages, when using windows servicesAnother good idea is to have an application that works as a monitor and gets the feedback from the service, since you can use sockets and you can use Window's message queue. Or you can use a smpt client to send e-mails reporting service problems.
-
How to use HashSettry this: HashSet stringSet = new HashSet { "abc", "aa" } ;
-
OnShown event not always triggeredOn some forms the OnShown event won't be raised and I was not able to figure out why, this is most strange because it works fine on most cases and I use a class that inherits the Form class and handles the event for me, so there should be no way for me to mess up with the event handling. Did anybody experience this problem?? Were you able to fix it?? I'd be most thankful if anyone could offer a piece of advise so I can solve this.
-
can I make zooming in the form itself ?I guess this is quite obvious, but besides making sure that you only redraw the desired area and not the whole control, make sure that you are not reading from the serial port un the UI thread. Long processes can interfere with the drawing of the form.