I'm working on a C# application, based on Telerik's OpenAccess technology.
The following piece of source code does not give any results (although the corresponding table contains a lot of data):
List<Setting> lijst = new List<Setting>();
try {
lijst = database.GetData<Setting>().ToList();
}
catch (Exception e)
{
log.Error($"Exception: [{e}], Message=[{e.Message}]");
}
log.Debug($"Count=[{lijst.Count()}]");
However, the following piece of source code (from another, similar program) does give results:
internal static IEnumerable<Lift> GetAll(IDatabaseConnection database)
{
return database.GetData<Lift>();
}
The only difference is can find, are the connectionstrings (according to the watch-windows):
- Non-working application :
"Data Source=localhost\\SQLEXPRESS;..."
- Working application :
"Data Source=localhost\SQLEXPRESS;..."
As you can see, one contains a single backslash, the other a double one.
However, both strings are created the same way:
- Non-working application :
Settings.DatabaseAddress = @"localhost\SQLEXPRESS";
- Working application :
Settings.DatabaseAddress = @"localhost\SQLEXPRESS";
Am I on the right track and are those single/double characters indeed an indication, explaining the wrong database behaviour, or am I on the wrong track here?
For your information: I'm working with Visual Studio 2022, version 17.5.5.