TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Ashraf Zaman
NA
57
15.4k
How to use EnterpriseLibrary Data Access Block in .NET Core?
Oct 4 2018 3:41 AM
I am trying to Use EnterpriseLibrary in .NET Core application. When I initialize "Database" by "DatabaseProviderFactory" like this
_DB = _Factory.Create(dbConnection);
it's showing error :
System.InvalidOperationException: 'The connection string for the database 'data source=.\MSSQLSERVER16;initial catalog=TestDB;user id=sa;password=abc@123;' does not exist or does not have a valid provider.'
I googled but didn't get any help. Is there anyone who can give me a suggestion or an example How can I Initialize "Database" in .NET Core Application. Below is my code snippet.
using Microsoft.Practices.EnterpriseLibrary.Data;
using Microsoft.Practices.EnterpriseLibrary.Common;
public class DbClass
{
DatabaseProviderFactory _Factory = new DatabaseProviderFactory();
public Database _DB = null;
string dbConnection = @"data source=.\MSSQLSERVER16;initial catalog=TestDB;user id=sa;password=abc@123;";
public DbClass()
{
_DB = _Factory.Create(dbConnection);
}
public string Insert()
{
DbCommand cmd = _DB.GetSqlStringCommand("");
return "";
}
}
Reply
Answers (
4
)
Send File to Device using BlueTooth using C#
Can we place multiple form runat<server> tag in single form