I've been wondering whats the "appropriate" way to configure AdventureWorks DB such that the WHOLE database can be access from Visual Studio and ASPNET webpages.
The problem I keep beating my head against is the schema problem which prevents me from accessing tables with different schema.
What I've done/can do so far is:
1. Installed AdventureWorks DB
2. Can run SQL cmds from Winforms apps and these are working as expected.
3. I've added MACHINENAME\ASPNET to the database. The default schema is "dbo".
4. The DB is running on the same server as the web server.
When I try to execute something trivial such as:
SqlConnection connection = new SqlConnection("Data Source=localhost;Initial Catalog=AdventureWorks;Integrated Security=true;");
try
{
connection.Open();
SqlCommand command = new SqlCommand("SELECT * FROM [Production.Product]", connection);
SqlDataReader reader = command.ExecuteReader();
...
To get the above to work I need to set the ASPNET users schema to Production.
I will admit I am a novice when it comes to SQL Server but I'm learning fast.
Can anyone help?
Short of trawling through a ton of code what was Microsofts intended usage of schema and how would one access tables located in multiple schemas from ASPNET.
Thanks,
Philip.
See the response at http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=166975&SiteID=1
No comments:
Post a Comment