sqlDataAdapter1.Fill(dataSet1) produces permissions error

  • Thread starter Thread starter Google Jenny
  • Start date Start date
G

Google Jenny

Hi.

My colleague and I have followed the procedure to populate a form with
data from a database, using this code:

private void bindGrid()
{
sqlConnection1.Open();
sqlDataAdapter1.Fill(dataSet1);
DataGrid1.DataBind();
sqlConnection1.Close();

}

When we run this, we get the following error message:

Server Error in '/ESSWebForm' Application.
------------------------------------------------------------------------
--------

SELECT permission denied on object 'sf1', database 'UCLA', owner 'dbo'.
Source Error:


Line 45: sqlDataAdapter1.Fill(dataSet1);

We followed instructions that included running sp_grantlogin and
sp_grantdbaccess for the user.

And now we're stuck. We can't figure out how to get access to tables and
other database objects.

In general, we're confused about where in VS .NET we program in
authentication/permissions.

Any help greatly appreciated

Thanks,
Google Jenny
 
Jenny,

Presumably you have a connection string somewhere, that the SqlConnection
object uses to connect to your database? That should contain details (a
username and password) of the account you're using to login to the database.
And it sounds like your database is SQL Server, is this right? The account
you login to the database as must have the appropriate permissions for
whatever it is you're trying to do (SELECT in this case), and these are set
in SQL Server.

Can you verify that what database you are connecting to, and that the
details in the connection string correspond to a login? Sorry if this isn't
much help, but with the details you provided it's difficult to be more
specific.

Toby Mathews
 
Hi, Toby.

We're using the generic MSDE server that comes with Visual Studio .NET.

While researching this, I've come across instructions to go to Microsoft
SQL Server in the Start Menu and configure permissions in some submenus
of that branch. But I have no such entry in my start menu.

YET! Under Server Explorer, it lists my server as a SQL Server.

Regarding the connection string:
Curiously, the connection string property for sqlConnection1 contains no
user name or password elements.

Flummoxed,
Google Jenny

P.S. My colleague is on the phone with MS tech support now, using up one
of his last free chits.
 
Jenny,

Ok, well I'm afraid I haven't had much experience with MSDE, but I would
say that's where your permissions would be - hopefully tech support have put
you on the right track though!

Toby
 
Back
Top