B
bennett
I'm trying to write an ASPX page that uses an OleDbDataAdapter to get
data from a SQL Server database. When I test the connection, it
returns success, and when I preview the data using the Adapter's
"preview data" right-click option, it works, but when I load the actual
page, I get the error "Cannot open database requested in login
'cookiecutter'. Login fails."
It seems to work when I use a pre-existing database like Northwind or
Portal, but not when I try creating a new one. But it looks like I'm
creating them correctly. Here are the exact steps:
1) In Visual Studio 2003 I go to Server Explorer, right-click "Data
Connections" and pick "Create new SQL Server database". I specify
BENNETTS_3_2002\NetSDK as the server name and "cookiecutter" as the new
database name. I select "Use Windows NT Integrated Security" as well.
2) The connection now appears, as expected, under Data Connections. If
I open its properties it shows BENNETTS_3_2002\NetSDK as the server
name, Use Windows NT Integrated Security is selected, and
"cookiecutter" is listed as the database to select. If I click "Test
Connection" it returns success.
3) In the ASP.Net project, I drop a new instance of an OleDbDataAdapter
onto a Web form, specify BENNETTS_3_2002\NetSDK.cookiecutter.dbo as the
data connection, and specify "SELECT wbuser.* FROM wbuser" as the
select command, the adapter gets created successfully. If I
right-click the adapter and click "Preview Data" I can see the contents
of the wbuser table being loaded.
4) BUT now if I put some code in the codebehind page like
DataSet objDataSet = new DataSet();
this.oleDbDataAdapter1.Fill(objDataSet);
when I actually try loading the page in the browser, I get the error
"Cannot open database requested in login 'cookiecutter'. Login fails."
Any idea what could cause this, if test-connection and preview-data
were reporting success? Could it have something to do with how I'm
creating the new database? Because if I go through the same steps
above but use a pre-existing database like Northwind or Portal, it
works. It only fails for the new databases I create. But I thought I
was creating them correctly, choosing "Use Windows NT Integrated
Security".
Help much appreciated, thanks!
-Bennett
data from a SQL Server database. When I test the connection, it
returns success, and when I preview the data using the Adapter's
"preview data" right-click option, it works, but when I load the actual
page, I get the error "Cannot open database requested in login
'cookiecutter'. Login fails."
It seems to work when I use a pre-existing database like Northwind or
Portal, but not when I try creating a new one. But it looks like I'm
creating them correctly. Here are the exact steps:
1) In Visual Studio 2003 I go to Server Explorer, right-click "Data
Connections" and pick "Create new SQL Server database". I specify
BENNETTS_3_2002\NetSDK as the server name and "cookiecutter" as the new
database name. I select "Use Windows NT Integrated Security" as well.
2) The connection now appears, as expected, under Data Connections. If
I open its properties it shows BENNETTS_3_2002\NetSDK as the server
name, Use Windows NT Integrated Security is selected, and
"cookiecutter" is listed as the database to select. If I click "Test
Connection" it returns success.
3) In the ASP.Net project, I drop a new instance of an OleDbDataAdapter
onto a Web form, specify BENNETTS_3_2002\NetSDK.cookiecutter.dbo as the
data connection, and specify "SELECT wbuser.* FROM wbuser" as the
select command, the adapter gets created successfully. If I
right-click the adapter and click "Preview Data" I can see the contents
of the wbuser table being loaded.
4) BUT now if I put some code in the codebehind page like
DataSet objDataSet = new DataSet();
this.oleDbDataAdapter1.Fill(objDataSet);
when I actually try loading the page in the browser, I get the error
"Cannot open database requested in login 'cookiecutter'. Login fails."
Any idea what could cause this, if test-connection and preview-data
were reporting success? Could it have something to do with how I'm
creating the new database? Because if I go through the same steps
above but use a pre-existing database like Northwind or Portal, it
works. It only fails for the new databases I create. But I thought I
was creating them correctly, choosing "Use Windows NT Integrated
Security".
Help much appreciated, thanks!
-Bennett