473,408 Members | 2,839 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

ASPNET won't connect to Northwind

I installed the Northwind database in my SQL Server developer version,
added [MyMachine\ASPNET] to the server logins, and in OSQL ran

use Northwind
GO

grant all to [MyMachine\ASPNET]
GO

These executed without error. But my test page is being denied access.

Learning to bind a datagrid to a SQL table for the first time, after
creating the connection and the adapter and all that, my code-behind
class has, in InitializeComponent:

this.sqlConnection1 = new System.Data.SqlClient.SqlConnection();
this.sqlDataAdapter1 = new System.Data.SqlClient.SqlDataAdapter();
this.dsCustomers1 = new _315c05.dsCustomers();
((System.ComponentModel.ISupportInitialize)(this.d sCustomers1)).BeginInit();

and, later,

this.sqlConnection1.ConnectionString = "workstation id=MYMACHINE;packet
size=4096;integrated security=SSPI;data source=MYM" +
"ACHINE;persist security info=False;initial catalog=Northwind";

followed by a bunch of mappings.

In Page_Load I have

sqlDataAdapter1.Fill(dsCustomers1, "Customers");
dgCustomers.DataBind();

Finally, my datagrid has DataSource set to dsCustomers1, DataMember set
to Customers, and DataKeyField set to CustomerID.

When I run the page, I get an error on the DataFill call:

Cannot open database requested in login 'Northwind'. Login fails. Login
failed for user 'MYMACHINE\ASPNET'.

I can see the contents of the Customers table just fine if I
double-click on it under the Data Connections section of Server Explorer
in Visual Studio.

Any ideas?
Aug 25 '06 #1
5 1732
>
and, later,

this.sqlConnection1.ConnectionString = "workstation id=MYMACHINE;packet
size=4096;integrated security=SSPI;data source=MYM" +
"ACHINE;persist security info=False;initial catalog=Northwind";
Seems that you have missed - "Provider=SQLOLEDB.1"...

Right-click on the connection in Visual Studio and select "Properties",
and check the entry for "ConnectString" in the list.

HTH,
indy

Aug 26 '06 #2
in******************@gmail.com wrote:
>and, later,

this.sqlConnection1.ConnectionString = "workstation id=MYMACHINE;packet
size=4096;integrated security=SSPI;data source=MYM" +
"ACHINE;persist security info=False;initial catalog=Northwind";

Seems that you have missed - "Provider=SQLOLEDB.1"...

Right-click on the connection in Visual Studio and select "Properties",
and check the entry for "ConnectString" in the list.
Thanks, but when I insert that into the connection string for
sqlConnection1 (with a semicolon afterwards) I get an error dialog,
Invalid Property Value. "Keyword not supported: 'provider'."

Googling this, I find that the Provider string is redundant because I'm
already using a SqlConnection. I would need it if I were using an
OleDbConnection.
Aug 27 '06 #3
Your initial post didn't mention which version of VS you are using. I
assumed that you were working through the examples in Amit Kalanis'
70-315 book!

I suggest you download and install Microsoft SQL Server Management
Studio Express - . It is freeware, and provides a very handy interface
to any SQL Server MSDE/SQL Server 2000 instance and SQL Sever 2005 /
SQL Server 2005 Express instance on your PC. After you connect to the
SQL Server in question, expand "Security", then "Logins". Since you
have added the ASPNET account, check the permissions of the user on the
Northwind database (Note that the above can be done by manually typing
in the right commands).
I am sure it is an issue with permissions on the database for the
ASPNET user.

HTH,
indy

Aug 27 '06 #4
indy wrote:
Your initial post didn't mention which version of VS you are using. I
assumed that you were working through the examples in Amit Kalanis'
70-315 book!
Correct! And it's VS 2003, .NET 1.1.
>
I suggest you download and install Microsoft SQL Server Management
Studio Express - . It is freeware, and provides a very handy interface
to any SQL Server MSDE/SQL Server 2000 instance and SQL Sever 2005 /
SQL Server 2005 Express instance on your PC. After you connect to the
SQL Server in question, expand "Security", then "Logins". Since you
have added the ASPNET account, check the permissions of the user on the
Northwind database (Note that the above can be done by manually typing
in the right commands).
Thanks for the tip.
Aug 27 '06 #5
Harlan Messinger wrote:
indy wrote:
>>
I suggest you download and install Microsoft SQL Server Management
Studio Express - . It is freeware, and provides a very handy interface
to any SQL Server MSDE/SQL Server 2000 instance and SQL Sever 2005 /
SQL Server 2005 Express instance on your PC. After you connect to the
SQL Server in question, expand "Security", then "Logins". Since you
have added the ASPNET account, check the permissions of the user on the
Northwind database (Note that the above can be done by manually typing
in the right commands).

Thanks for the tip.
Well, I found that I had created a user called Northwind in the master
database, and nothing in the Northwind database. That, even though I'd
gone through the GRANT exercise twice, as described in my original
message. I don't get it, but the Management Studio let me do what I
needed to. I hadn't known you could get that for free, so I'm grateful
for the pointer.
Aug 27 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Peter Morris | last post by:
Newbie question, I'm just learning ASP I am having trouble connecting to a database. I have set up the ODBC data source Northwind to link to the Northwind database. Now, I'm running the...
6
by: Mandar Patil | last post by:
H I am getting following error Login failed for user 'machinename\ASPNET when tryiong to do the following: SqlDataAdapter1.Fill(DataSet11 This user is never specified in the database and never...
2
by: buzz | last post by:
I've tried to use the Data Wizard to connect to the Northwind sample database in Office. I can preview the data in the data adapter, but when I run the ASP page I get this error.... The Microsoft...
1
by: buzz | last post by:
Thanks Ken, I found a possible fix, one of which was changing a attribute in the machine.config file called userName="Machine" to userName="System". I tried that and it worked. Does this cause any...
4
by: Zalak Dedhia via DotNetMonster.com | last post by:
Hello Guys, I need some help urgently regarding the code to connect to the SQl Server on a remote machine and possible configurations to make, or chanegs in the connection string or so. I...
3
by: Familjen Karlsson | last post by:
Here is an example from the help on the keword OleDbConnection, in VB.Net, they don't give the path to the database just the word localhost. How can it connect to the database without knowing where...
1
by: podx | last post by:
I am trying to connect to SQL 7.0 northwind database via visual studio 2005. But I can't open the connection. I get an error saying remote access is not allowed. But the remote access is ok. I can...
0
by: scotty | last post by:
In testing Notifications, adding the following lines to an Asp.Net page make the notification process almost fully automatic: ...
4
by: shapper | last post by:
Hello, I am using Microsoft Enterprise Library, on a class, to connect to a database as follows: Dim db As Database = DatabaseFactory.CreateDatabase("DatabaseName") However, I would like...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.