Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Question : connection string for module
hyeongseong
#1 Posted : Wednesday, September 07, 2011 8:19:38 AM(UTC)
Rank: Member
Groups: Registered

Joined: 8/10/2011(UTC)
Posts: 12
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.
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF 1.9.5.5 | YAF © 2003-2011, Yet Another Forum.NET
This page was generated in 0.044 seconds.