Hi
I am working on kooboo module that connects database and
populate data on a page.
I created a Linq to Sql classes in Model folder.
and after that. index() In HomeController.cs
I did like below to return data to the view index.cshtml
public ActionResult Index()
{
vwIssuesDataContext dataContext = new vwIssuesDataContext();
List<vwIssue> willInsert = dataContext.vwIssues.ToList();
return View(willInsert);
}
but the problem is that my module can not find a connectionString
when I open the page. the errro messasge says like below.
Server Error in '/' Application.
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
Source Error:
Line 33: #endregion
Line 34:
Line 35: public vwIssuesDataContext() :
Line 36: base(global::System.Configuration.ConfigurationManager.ConnectionStrings["SBHUBConnectionString"].ConnectionString, mappingSource)
Line 37: {
Source File: C:\Users\dev\Desktop\koobooWorkspace\vWIssues\MvcApplication\module\Models\vwIssues.designer.cs Line: 35
When I create Linq to Sql classes file in model folder and build the module project
It generates connection string in web.config file, but it shows still errors.
so I put connection string in module.config, but it still the same.
I think that it seems like the module can not find the connection string for database.
Where should I put the connection string? any help, I will really appreicate that.