Dashboard > iBATIS DataMapper > Home > Frequently Asked Questions > How does NPetshop connect to SqlSever2005?
How does NPetshop connect to SqlSever2005?
Added by dongguofeng, last edited by dongguofeng on Aug 21, 2009
Labels: 
(None)


I downloaded a NPetshop project, I start it on SqlSever2005, but it can't work. There is a exception.

Error on page
Exception : at NPetshop.Presentation.UserActions.CatalogAction..ctor(HttpContext context) at NPetshop.Web.UserControls.SideBar.LinkButton_Command(Object sender, CommandEventArgs e) in c:\inetpub\wwwroot\npetshop.web\usercontrols\sbr.ascx.cs:line 30 at System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e) at System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) at System.Web.UI.Page.ProcessRequestMain()
Error message : "NPetshop.Presentation.UserActions.CatalogAction"的类型初始值设定项引发异常。
Source : NPetshop.Presentation
View : StartUp

The content of my config file is as follow.

SqlMap.config:
<?xml version="1.0" encoding="utf-8"?>
<sqlMapConfig xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="SqlMapConfig.xsd">
<settings>
<setting useStatementNamespaces="false"/>
<setting cacheModelsEnabled="true"/>
</settings>

<!-- ==== SqlClient configuration ========= -->
<!-- Optional ( default ) -->
<!-- Rem : If used with a Dao it will be ignored -->
<database>
<provider name="sqlServer1.1"/>
<dataSource name="NPetshop" connectionString="data source=127.0.0.1\SQLEXPRESS;database=NPetshop;user id=NPetshop;password=123456;connection reset=false;connection lifetime=5; min pool size=1; max pool size=50;"/>
</database>

<sqlMaps>
<sqlMap resource="Maps/Category.xml"/>
<sqlMap resource="Maps/Product.xml"/>
<sqlMap resource="Maps/Item.xml"/>
<sqlMap resource="Maps/Account.xml"/>
<sqlMap resource="Maps/Sequence.xml"/>
<sqlMap resource="Maps/LineItem.xml"/>
<sqlMap resource="Maps/Order.xml"/>

</sqlMaps>

</sqlMapConfig>

DataBase.config
<?xml version="1.0" encoding="utf-8" ?>
<settings>
<!-- User application and configured property settings go here.-->
<!-- Example: <add key="settingName" value="settingValue"/> -->
<add key="userid" value="NPetshop" />
<add key="password" value="123456" />
<add key="database" value="npetshop" />
<add key="datasource" value="127.0.0.1\SQLEXPRESS" />
</settings>


Site running on a free Atlassian Confluence Open Source Project License granted to OSS. Evaluate Confluence today.
Powered by Atlassian Confluence, the Enterprise Wiki. (Version: 2.5.5 Build:#811 Jul 25, 2007) - Bug/feature request - Contact Administrators