Showing posts with label express. Show all posts
Showing posts with label express. Show all posts

Monday, March 19, 2012

"User does not have permission to perform this action." problem

hey people

having a nightmare getting asp.net 2.0 to work with sql server 2005 express, bit of a newbie with it. trying to display a table from my sql database and every time i run the aspx table im getting this error.

 User does not have permission to performthis action.Description: An unhandled exception occurred during the execution of the current web request. Please review the stack tracefor more information about the error and where it originatedin the code.Exception Details: System.Data.SqlClient.SqlException: User does not have permission to performthis action.Source Error:An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identifiedusing the exception stack trace below.Stack Trace:[SqlException (0x80131904): User does not have permission to performthis action.] System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +734995 System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +188 System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +1838 System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK) +33 System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) +628 System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) +170 System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) +130 System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) +28 System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) +424 System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject) +66 System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) +496 System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +82 System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +105 System.Data.SqlClient.SqlConnection.Open() +111 System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +121 System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +137 System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable) +83 System.Web.UI.WebControls.SqlDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +1770 System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +17 System.Web.UI.WebControls.DataBoundControl.PerformSelect() +149 System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +70 System.Web.UI.WebControls.GridView.DataBind() +4 System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +82 System.Web.UI.WebControls.CompositeDataBoundControl.CreateChildControls() +69 System.Web.UI.Control.EnsureChildControls() +87 System.Web.UI.Control.PreRenderRecursiveInternal() +41 System.Web.UI.Control.PreRenderRecursiveInternal() +161 System.Web.UI.Control.PreRenderRecursiveInternal() +161 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1360
 keep getting the user permission error, even though it says on the management console that i have access to the database
 
any ideas?
 
rob 
 

ok the error doesnt tell you that you cant login

the problem is you already login but you cant do action.

can you look your connection string and find out what account are you using.

then check that account's right in your SQL 2005 database,

maybe the right in that account is very small

|||

check if you user have not only rights to connect to database but also right to select from tables you use or execute rights to stored procedures so check database security and your user effective permissions on database objects

Thanks

|||

(having a nightmare getting asp.net 2.0 to work with sql server 2005 express, bit of a newbie with it. trying to display a table from my sql database and every time i run the aspx table im getting this error.)

If you don't have Management Studio you can download it in the first link below and the second link covers how to add object permissions for the Asp.net account post again if you still have question. Hope this helps.

http://msdn.microsoft.com/vstudio/express/sql/download/

http://forums.asp.net/thread/1492092.aspx

Tuesday, March 6, 2012

"Not enough Storage"

When I tried to save a stored proedure (in SQL Server 2005 Express), I got a
n
error saying "The operation could not be completed. Not enough storage is
available to complete this operation."
Any idea what is causing this error to pop up? I still have about 4GB disk
space left.
Thanks.SQL Express has a 4GB limit on the database size so if you're at that limit
you are out of space no matter how much disk space is left.
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
"Swami" <Swami@.discussions.microsoft.com> wrote in message
news:E6536E4F-31BE-4609-9DFC-FFCC5C6A1CD2@.microsoft.com...
> When I tried to save a stored proedure (in SQL Server 2005 Express), I got
> an
> error saying "The operation could not be completed. Not enough storage is
> available to complete this operation."
> Any idea what is causing this error to pop up? I still have about 4GB
> disk
> space left.
> Thanks.|||My whole MSSQL folder is only 148 MB and my particular database in question
is only 2MB in size. I actually have very little data...about 7-8 tables
which are mostly empty and about 25 stored procedures, each of them quite
short. Any ideas?
Thanks.
"Roger Wolter[MSFT]" wrote:

> SQL Express has a 4GB limit on the database size so if you're at that limi
t
> you are out of space no matter how much disk space is left.
> --
> This posting is provided "AS IS" with no warranties, and confers no rights
.
> Use of included script samples are subject to the terms specified at
> http://www.microsoft.com/info/cpyright.htm
> "Swami" <Swami@.discussions.microsoft.com> wrote in message
> news:E6536E4F-31BE-4609-9DFC-FFCC5C6A1CD2@.microsoft.com...
>
>|||Well, one guess is you might have choosen the option
Do not autogrow
right click on database -> properties -> datafiles
check - Automatically grow file.
and also
maximum file size -> unrestricted file growth.
Do the same in log files. And see.
Hope this helps.
And I believe this is your test database. (and not production :)|||What tool are you using to create the stored procedure? You might try
saving the proc script to a file and creating with the SQLCMD.EXE
command-line utility.
Hope this helps.
Dan Guzman
SQL Server MVP
"Swami" <Swami@.discussions.microsoft.com> wrote in message
news:E6536E4F-31BE-4609-9DFC-FFCC5C6A1CD2@.microsoft.com...
> When I tried to save a stored proedure (in SQL Server 2005 Express), I got
> an
> error saying "The operation could not be completed. Not enough storage is
> available to complete this operation."
> Any idea what is causing this error to pop up? I still have about 4GB
> disk
> space left.
> Thanks.|||this message indicated a bug referenced in sql server 2000 if you are using
lookups...
try your error message with google
Nicolas Guinet
"Swami" <Swami@.discussions.microsoft.com> a crit dans le message de news:
E6536E4F-31BE-4609-9DFC-FFCC5C6A1CD2@.microsoft.com...
> When I tried to save a stored proedure (in SQL Server 2005 Express), I got
> an
> error saying "The operation could not be completed. Not enough storage is
> available to complete this operation."
> Any idea what is causing this error to pop up? I still have about 4GB
> disk
> space left.
> Thanks.|||You may want to check out this link too.
http://support.microsoft.com/defaul...;166840&sd=tech

Saturday, February 25, 2012

"Login Failed" for SQL Express

Whenever I try to connect to my SQL Express Database with C# code,(.net 2.0), it says "Login failed for user 'TUser'. The user is not associated with a trusted SQL Server connection."

But I can connect with SQL Express Manager.

I've heard somewhere this is a SQL authentication problem, I didn't enable it during installation.

So is there a way to fix this? How can I enable SQL authentication without uninstalling it?

Is there anyone to help me?

"Login failed for user MyPC/ASPNET"

Hi

I created my DB in SQL 2005 Express in VS IDE. I have my app in IIS. When I try to use the DB (e.g. try to login a user in the app) it gives me the following error:

Cannot open database "cvRepository" requested by the login. The login failed.
Login failed for user 'MyPC\ASPNET'.

My guess was that I had to give permissions to ASPNET user so I did in SQL Server Management. Still not working! Checked my Connection string and I think it's fine...

connectionString="Data Source=.\SQLEXPRESS;Database=cvRepository;Integrated Security=True;User Instance=True"

Still not working!

Can anyone explain me what's wrong and to solve this?!

Try replacing Database=cvRepository withAttachDBFileName=|DataDirectory|cvRepository.mdfin your connectionString.

Hope this helps.

Mike

|||Do you have a database namedcvRepositoryon your SQL server? Or you're using a database file attached at runtime? Anyways you have to ensure the ASPNET account has login permission to the SQL server, as well as access permissions on the required database.|||

Hi

Tried using the AttachDBFileName but nothing:

<

addname="cvRepositoryConnectionString"connectionString="Data Source=.\SQLEXPRESS;AttachDBFileName=|DataDirectory|cvrepository.mdf;Integrated Security=True;User Instance=True"providerName="System.Data.SqlClient" />I don't understand much of this but I'll shoot out something... When running the app in debug mode (http://localhost:2431/cvRepository/Default.aspx) it creates an instance of the SQL Server but when not doing so (http://localhost/cvRepository/Default.aspx) it doesn't, that's why I can't access the DB. Is this correct? If so, how to solve it?

Any explanation/article would be helpful!

Thx

|||Try to add the ASPNET login to a member ofsysadminordbcreatorserver role.|||

Hi

Instead of using User Instances I defined a particular user to access the DB. Used this:

connectionString

="Server=.\SQLEXPRESS;Database=cvrepository;User ID=user1;Password=user1pass"

Thx for your help

Cheers

Thursday, February 16, 2012

"Failed to generate a user instance of SQL Server" using sql server express and vwde. why?

I've set up a website on another computer using sql server express and visual web developer express, and it works as expected. However halfway through the development i've had to move to another computer. I installed visual web developer express + sql server express, and copied the project files across, but now when I attempt to run it I get the error:

Failed to generate a user instance of SQL Server due to afailure in starting the process for the user instance. The connectionwill be closed.

I've tried reinstalling the software and it doesn't help. Any idea why this is happening, and what I can do to fix it?

thanks

How to fix it is covered in the link below change the configuration. Hope this helps.

http://blog.krisvandermast.com/FailedToGenerateAUserInstanceOfSQLServerDueToAFailureInStartingTheProcessForTheUserInstanceTheConnectionWillBeClosed.aspx

|||

Hi,

I changed the built in account to 'local system' in the SQL server configuration manager, and deleted my SQLEXPRESS folder, then restarted the computer, but the same thing is happening. Is there anything else I need to do to fix this?

thanks for your help

|||

I am sorry you error sent me on the wrong track because moving a database created in one box and moving it to another is not a simple copying files over. That is the reason the solution I gave you did not fix your problem so delete the folder. When you are moving your database to a new computer you need to do it manually through code like the second link below. You need to check your access permissions to the new computer and follow the guide created by Microsoft in the second link if the forum posting in the first link below did not fix your problem. Hope this helps.

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=125227&SiteID=1

http://support.microsoft.com/default.aspx?scid=kb;en-us;224071

"Failed to generate a user instance of SQL Server" - Redux

I have SQL Server 2005 SP1 Dev Edition installed on my laptop along with Visual Web Developer 2005. I installed SQL Server Express 2005 SP1. I then created a new web site using the Club Web Site template.

I did the recommended initial build to get the Membership database installed and got an error page (http://localhost:1667/WebSitesVB2/):

SQLExpress database file auto-creation error:
Failed to generate a user instance of SQL Server due to a failure in starting the process for the user instance. The connection will be closed.

There were 4 recomme4ndations from the error page. I have met three of them: (1) the AppDaa folder that was created when I used the Club Web Site template; (2) my machine's ASPNET user set up with full control permissions on the APP Data Folder; (3) SQL Server Express successfully installed on my machine.

The 4th recommendation from the error page is "The process identity for the web server account must have a local user profile. See the readme document for details on how to create a local user profile for both machine and domain accounts. ". I have no idea of how to do this or how/where to find the elusive the "readme" file.

I am at a loss as to what to do next. I have spent the day going over forums on this error and none seem to provide consistent or relevant answers.

Try to remove User Instance=true from your connection string, if you don't need to generate a user instance at runtime. For more information about the user instance attribute, you can refer to:

http://msdn2.microsoft.com/en-us/library/system.data.sqlclient.sqlconnection.connectionstring(VS.80).aspx|||

Changed userinstance = TRUE to userinstance=FALSE. Same result - failure to generate userinstance.

Is it possible that there is some setting in VWD that provides a connection string for the ASPNET db that is to be created? The only connection string in the WebConfig from the original template is the one for the ClubSite DB. There is none for the ASPNET db (because the template does not provide the ASPNET DB.

After 2 tries, I still get this error and when I look at the database explorer, there is only one DB file: Club.MDF.

Anyone else have any answers?

|||

I probably should have included this stack trace:

Stack Trace:

[SqlException (0x80131904): Failed to generate a user instance of SQL Server due to a failure in starting the process for the user instance. The connection will be closed.] System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +115 System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +346 System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +3244 System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK) +56 System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) +1084 System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) +272 System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) +355 System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup) +91 System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +115 System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +122 System.Data.SqlClient.SqlConnection.Open() +229 System.Web.Management.SqlServices.GetSqlConnection(String server, String user, String password, Boolean trusted, String connectionString) +110[HttpException (0x80004005): Unable to connect to SQL Server database.] System.Web.Management.SqlServices.GetSqlConnection(String server, String user, String password, Boolean trusted, String connectionString) +181 System.Web.Management.SqlServices.SetupApplicationServices(String server, String user, String password, Boolean trusted, String connectionString, String database, String dbFileName, SqlFeatures features, Boolean install) +167 System.Web.Management.SqlServices.Install(String database, String dbFileName, String connectionString) +46 System.Web.DataAccess.SqlConnectionHelper.CreateMdfFile(String fullFileName, String dataDir, String connectionString) +681



|||Sorry I forgot to mention: there is a connection string named LocalSqlServer, which is used by .NET 2.0 built-in providers (Profile, Membership, RoleManager, etc.). You can override it and try again, for details you can refer to:
Configuring ASP.NET 2.0 Application Services to use SQL Server 2000 or SQL Server 2005

Thursday, February 9, 2012

"Changed Context to ..." message when editing permissions w/ VBA

I have a client using a small SQL Express database with an Access front end.

I've created a form in the front end that allows a supervisor the ability to perform two very basic security operations. 1) Adding a new user, and 2) granting/removing write privileges. The code behind the form uses VBA to build some T-SQL strings and then executes them via an ADO connection.

The strings are as follows:

1) Add new login to server:
"CREATE LOGIN [NETWORK\UserName] FROM WINDOWS WITH DEFAULT_DATABASE = MyDatabase"

2) Add user to database:
"USE MyDatabase CREATE USER [NETWORK\UserName]"

3) Grant Write Permissions:
" USE MyDatabase EXEC sp_addrolemember 'db_datawriter', 'NETWORK\UserName' "

4) Remove Write Permissions:
" USE MyDatabase EXEC sp_droprolemember 'db_datawriter', 'NETWORK\UserName' "

I have full privileges over the server & database, and everything runs perfectly.

However, when the supervisor - whose login includes security admin privileges - tries this, he gets a message that says "Changed Context to MyDatabase, Error# -2147217900, 80040e14" and the code fails.

If I grant him "db_owner" status, the message does not come up and everything runs perfectly.

I'm not a security guru or anything, but I suspect that it's not the greatest idea to hand out db_owner privileges.

I ran a search, and the best I could come up with were a couple of KB articles:
http://support.microsoft.com/default.aspx?scid=KB;EN-US;197459
http://support.microsoft.com/default.aspx?scid=KB;EN-US;143339

I'm not even sure these articles are talking about what's happening..

Any ideas?When is the last time your boss ran an office update? Or more specifically, which MDAC is he using?|||When is the last time your boss ran an office update? Or more specifically, which MDAC is he using?
I'm not at the client's location right now, so I can't give a firm answer.. but I had someone there gather the following info..

Access is version 11.6566.8132 SP2

They're running XP Pro version 2002 SP2.

Per this page: http://support.microsoft.com/kb/231943/en-us they should be on at least MDAC 2.8 SP1. However based on the release dates shown on that page, I wouldn't be suprised if they were running 2.8 SP2.

Does that help?|||Ok, went by their office yesterday. MDAC is version 2.8.1117.0.

After a little more time spent, it appears as if this is the 'informational' message passed back to ODBC. It appears that I need to figure out how to trap for it in VB. The KB articles I posted got me started, but I need some more work..

I also seem to still have a SQL issue.. In the little bit of troubleshooting I had time for, it also appears that I have a 2nd error coming in behind the "changed context.." message. If the user is not a dbowner, it says that he doesn't have permissions to run these operations.

Is this correct? Is dbowner status required to change permissions of other users?

"Cannot Open Database" problem when copy project to IIS

Hi all.

I use VWD 2005 Express with SQL Server 2005 Express as a database.

I copy my project to IIS and try to run it at the IIS Web Server.

I already amended the connection string at web.config file as below:

<connectionStrings> <add name="GeekSpeakConnectionString" connectionString="Data Source=SEN-M09\SQLEXPRESS;Database=GeekSpeak.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True" providerName="System.Data.SqlClient" /></connectionStrings>
But, I got this error:

Cannot open database "GeekSpeak.mdf" requested by the login. The login failed.
Login failed for user 'SEN-M09\ASPNET'.

I also has granted to userSEN-M09\ASPNET .Still, I got this error. Why?

I manage to solve this problem after reading the articlehere.

Thanks.

Friday, January 27, 2012

! PLEASE HELP !! Collation selection on install

Hi, I need to change the collation when I install SQL Express 2005 to SQL_LATIN1_GENERAL_CP1_CI_AS but the drop down on setup only allows

LATIN1_GENERAL.

How do I get the correct collation to appear?

Thanks for any help/tips

hi,

as you can see in http://msdn2.microsoft.com/en-us/library/ms144250.aspx, SQL collations are for compatibility with older settings and are not directly listed (as you want them) in the installation wizard.... you can "only" choose a Windows collation, that lists all the variations of each particular collation, or SQL collation, that you have to "customize" to fit your needs.. so, for SQL_LATIN1_GENERAL_CP1_CI_AS you have to choose Dictionary order, case-insensitive, 1252 character set (or alternate locale to fit your needs)..

regards

|||Kool....thanks a million that did the trick ;-)