Version: 19.4450.0.52
MVC 5
I am trying to established a connection to sql server from XLS IO but I keep getting invalid connection string with IConnection, I try same connection string with SqlDataReader and its working.
Debugging Result (see attached image):
- DBConnectionString is null
- SourceFile=localhost;
Did I construct the connection string wrongly? or it does not accept direct connection to sql server
Appreciate if someone can give guidance on how can I connect directly to sql server with XLS IO.
This is my code
var connectionString = ConfigurationManager.ConnectionStrings["DefaultConnection"].ToString();
string query = "SELECT * FROM People";
IConnection connection = workbook.Connections.Add("DefaultConnection", "Sample connection with SQL Server", connectionString, query, ExcelCommandType.Sql);
Connection Strings
<add name="DefaultConnection" connectionString="Data Source=localhost;Initial Catalog=TestDB;Integrated Security=SSPI;" providerName="System.Data.SqlClient" />