I'm using the Simple.Data ORM to hook up a database from within the Visual Studio environment that's defined in a local sql file (named convertcsv.sql). I'm following the instructions detailed here, and thus far, I've installed Simple.Data.SqlServer and Simple.Data.Ado via NuGet, have the following in my App XML file:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<connectionStrings>
<add name="Simple.Data.Properties.Settings.DefaultConnectionString"
connectionString="convertcsv" />
</connectionStrings>
I have the following in my Program.cs file:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Simple.Data;
namespace DatabaseWalkthrough{
class Program{
static void Main(string[] args){
var db = Database.Open();
var tmp = db.mytable.FindAll(db.mytable.NC == 505);
foreach (var d in tmp){
Console.WriteLine(d.NC);
Console.ReadKey();
}
}
}
}
NOTE: In the convertcsv.sql file, there is only one table (mytable) and NC is one of its well-defined fields containing integral values.
At the line where the foreach loop is initialized, the debugger alerts the following error:
Additional information: Format of the initialization string does not conform to specification starting at index 0.
A little bit of sleuthing reveals this Stack Overflow question a similar problem, but that particular instance of the error appears to have been caused by improper credentials to access a database on a server, whereas I'm trying to propagate a database into my C# app in Visual Studio to update it.
I have the following hypotheses for why this could be an issue:
1) The App config XML file cannot locate the convertcsv.sql file. Somewhat unlikely since I preemptively added this file into all of the project subdirectories.
2) Missing parameters - this is possible since I've seen some variation for how DB connections are arranged in the App config file, but the Simple.Data documentation is somewhat translucent.
Any other ideas?