Visual Studio 웹 양식 응용 프로그램에서 SQLEXPRESS2014에 연결하려고합니다. 연결되는 것 같지만 잘못된 개체 이름 'HumanResources.Employee'가 표시됩니다.
System.Data.SqlClient.SqlException : 잘못된 개체 이름 'HumanResources.Employee'.
Management Studio에서 databse를 쿼리하면 결과가 반환됩니다.
AdventureWorks2012 데이터베이스를 사용하고 있습니다. 이 데이터 소스를 사용하여 Gridview에 바인딩합니다.
aspx 페이지
<asp:sqldatasource id="CustomersSource"
selectcommand="Select [BusinessEntityID], [NationalIDNumber], [LoginID]
From [HumanResources.Employee]"
connectionstring="<%$ ConnectionStrings:AdvWorksConnection%>"
runat="server"/>
연결 문자열
<connectionStrings>
<add name="AdvWorksConnection" connectionString="data source=localhost\SQLEXPRESS2014;
initial catalog=AdventureWorks2012;persist security info=True;
Integrated Security=True;"
providerName="System.Data.SqlClient" />
</connectionStrings>
내가 어디에서 잘못하고 있는지 말해 줄 수 있습니까? 연결 문자열에 문제가 있습니다.
나는 당신이 이것을 원한다고 믿습니다.
<asp:sqldatasource id="CustomersSource"
selectcommand="Select [BusinessEntityID], [NationalIDNumber], [LoginID]
From [AdventureWorks2012].[HumanResources].[Employee]"
connectionstring="<%$ ConnectionStrings:AdvWorksConnection%>"
runat="server"/>
반면에 AdventureWorks2012
데이터베이스, HumanResources
스키마 및 Employee
테이블입니다.
NB : [AdventureWorks2012].
연결 문자열이 명시 적으로 AdventureWorks2012
데이터베이스 를 사용하도록 말 했으므로 제거해도 쿼리는 계속 실행되어야 합니다.
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다