This forum is for programmers who have questions about the source code.
-
wjstarck
- Posts: 942
- Joined: Tue Jul 31, 2007 7:18 am
- Location: Keller, TX
-
Contact:
Post
by wjstarck » Tue Dec 31, 2019 8:15 pm
This code has been working for many years, but is suddenly broken in OD 19.4
Code: Select all
string command = "SELECT AddEnhancedMenuItems FROM anesthpreference";
return Convert.ToBoolean(DataCore.GetScalar(command));
So to get it working, I have to rewrite it as
Code: Select all
string command = "SELECT AddEnhancedMenuItems FROM anesthpreference";
string result = DataCore.GetScalar(command);
bool prefResult = Convert.ToBoolean(Convert.ToInt32(result));
return prefResult;
Why?
Cheers,
Bill Starck, DDS
Big Idea Software, LLC
Developer, EASy(Electronic Anesthesia System) for Open Dental
817-807-1709
TX, USA
-
cmcgehee
- Posts: 711
- Joined: Tue Aug 25, 2015 5:06 pm
- Location: Salem, Oregon
Post
by cmcgehee » Wed Jan 01, 2020 8:01 am
Did you used to store AddEnhancedMenuItems as "true" and now you're storing it at "1"?
-
wjstarck
- Posts: 942
- Joined: Tue Jul 31, 2007 7:18 am
- Location: Keller, TX
-
Contact:
Post
by wjstarck » Wed Jan 01, 2020 10:13 am
Always stored as 1 or 0
Cheers,
Bill Starck, DDS
Big Idea Software, LLC
Developer, EASy(Electronic Anesthesia System) for Open Dental
817-807-1709
TX, USA
-
cmcgehee
- Posts: 711
- Joined: Tue Aug 25, 2015 5:06 pm
- Location: Salem, Oregon
Post
by cmcgehee » Thu Jan 02, 2020 7:51 am
When I run Convert.ToBoolean("1") in C# 7.3 using .NET Framework 4.5.2 in Visual Studio 2019, it gives a FormatException. I cannot vouch for its behavior in older versions of C# or .NET.
-
wjstarck
- Posts: 942
- Joined: Tue Jul 31, 2007 7:18 am
- Location: Keller, TX
-
Contact:
Post
by wjstarck » Fri Jan 03, 2020 10:05 am
Chris-
I store those as tinyints in my tables instead of bools. Could that be the problem?
Cheers,
Bill Starck, DDS
Big Idea Software, LLC
Developer, EASy(Electronic Anesthesia System) for Open Dental
817-807-1709
TX, USA
-
cmcgehee
- Posts: 711
- Joined: Tue Aug 25, 2015 5:06 pm
- Location: Salem, Oregon
Post
by cmcgehee » Mon Jan 06, 2020 7:40 am
I don't think so. We store bools as tinyints as well.