.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

getting sqlserver error 40 with "roles.AddUserToRole"

Posted By:      Posted Date: September 02, 2010    Points: 0   Category :ASP.Net
Hi,I am using Membership in my asp.net website built using VS-2005.I am able to create a new user using them Membership.CreateUser method or from asp.net Website Configuration but when I run "roles.AddUserToRole" from code-behind or create a new role using ASP.NET WebsiteConfiguration I am getting the following error (in asp.net website configuration).There is a problem with your selected data store. This can be caused by an invalid server name or credentials, or by insufficient permission. It can also be caused by the role manager feature not being enabled. Click the button below to be redirected to a page where you can choose a new data store. The following message may help in diagnosing the problem: An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)I have followed these steps:-1>Enabled forms authentication in web.config by using <authentication> and <authorization> tags and verified the same set main.html as start page and set frmlogin.aspx as loginurl and upon running the website the user was getting redirected to frmlogin.aspx2>removed localsqlserver from connectionstrings and again

View Complete Post

More Related Resource Links

[298] SQLServer Error: 9001, The log for database 'tempdb' is not available.

I have SQL server 2000 standard edition running on Windows 2003 server. I am getting this error [298] SQLServer Error: 9001, The log for database 'tempdb' is not available. [SQLSTATE HY000] (ConnIsLoginSysAdmin) I have enough space and tempdb log file set  on unrestricted groeth. I don't know why I am getting this error

JDBC connection to SQLserver failing with ERROR [JDBCExceptionReporter] The connection is closed.

SQL server version: MS 2005 9.00.3050.00 Std edition Development version is on a stand alone server. Production is on an active/active cluster. Full error message below. There is an explanation and solution as noted below. However we do not see this issue in all our environments. Can anyone tell me why we see this issue in our production environment but not on our development environment, especially as the issue seems to arise following low usage times. Explanation / Solution If you are using the v1.2 driver, and you can positively rule out transient network connectivity issues and multithreaded usage, the next most common cause I am aware of is where a connection pool is being used and the pooling manager (e.g. DBCP or C3PO) does not test pooled connections for validity before handing them out to the app. What happens in this case is connections that sit idle in the pool for a very long time get closed by the TCP/IP stack, routing hardware, etc. Then they're already dead when the pooling manager hands them out. The solution is to configure the pooling manager to validate connections before handing them out, typically using a validation query like "SELECT 1". Error Message INFO | jvm 1 | 2010/09/07 07:52:11 | [09.07 07:52:11.396] LOG ERROR BROKO-EY-TBF-REDUCED-ENV-DP> INFO | jvm 1 | 2010/09/07 07:52:11 | - broko.quark.QueueMonitorThread.getNextCommand(QueueM

SQLServer Express 2008 R2 - Cannot connect Error: 18456, Severity: 14, State: 11.

I have just installed  running MSSQL Server 2008 R2 (Express), along with Visual Web Developer 2010 Express In SQL Server Configuration Manager I can see the SQL Server Service running (SQLEXPRESS) and the SQL Server Browser service running. On running SQL Server Management Studio when trying to log on I get the message Login failed for user Phil-PC`Phil (Microsoft SQL Server, Error: 18456) In the SQL Server Error log I see this error 2010-09-16 10:24:16.07 Logon       Error: 18456, Severity: 14, State: 11. 2010-09-16 10:24:16.07 Logon       Login failed for user 'Phil-PC\Phil'. Reason: Token-based server access validation failed with an infrastructure error. Check for previous errors. [CLIENT: <local machine>] I have been unable to find anything useful on Google on how to resolve this problem. I have tried running the command line utility sqlcmd -L and this lists the following Servers:     Phil-PC     Phil-PC\SQLEXPRESS   In my list of Installed programs in Control Panel I see both MS SQL Server 2008 & MS SQL Server 2008 R2, is that correct?

On Change:Prevent Evaluation fails with error Could not load file or assembly 'Microsoft.SqlServer.


Hi All,

I am facing a strange issue with Policy Based Management. Exact problem is as below

SQL Setups


I have Lenovo laptop having 3 SQL instances installed on it.

SQL Server 2005 (x86) Developer Edition 9.00.4053  -- Named Instance : SQL2K5

SQL Server 2008 (x86) Developer Edition 10.0.1600.22 -- Named Instance : SQL2K8

SQL Server 2008 R2 (x86) Developer Edition 10.50.1600.1 -- Named Instance : SQL2K8R2


I configured SQL2K8R2 instance as a Centralized Server and registed SQL2K8 & SQL2K5 under this. I configured a new condition by using facet: MULTIPART NAME. As per this condition Table Should start with TEST_ in database TEST . Evaluation Mode set to              On Change: Prevent. Idea is if some one logs to database TEST and tries to create table with name other then starting with TEST_ then it should fail.

I Imported this policy on registered servers thru Centralized Management Server Action, as expected policy got configured on Registred SQL2K8 instance

SqlServer 2008 Express Install error


Guys, any one know how to fix this ?

I installed the SqlServer Express 2008 on top of WinXp sp2 with .net framework and sdk 3.5

Now when I try to start the sqlexpress service it does not start and event log has following exception..

FileMgr:Tongue TiedtartLogFiles: Operating system error 2(The system cannot find the file specified.) occurred while creating or opening file 'e:\sql10_main_t\sql\mkmastr\databases\objfre\i386\modellog.ldf'. Diagnose and correct the operating system error, and retry the operation.

Now on my system I have only c:\ drive no e:\

Does any one know how to fix this ?
Is there a way to create this master database somehow using command line?

I really don't want to uninstall/install ?

Parameters with DBNull.Value becomes "default" and causes error in SqlServer


Hi, I have a table with a nullable column.

When I try to insert a record using INSERT statement I pass a parameter set to the value DBNull.Value.

Then I get an error from the SqlServer saying that the parameter was not supplied.

Using Sql-profiler i see that the applied parameter is set to the keyword 'default'.

I try to run the query inside Sql Server Management Studio, it looks something like this:

exec sp_executesql N'INSERT INTO [tbl] ([Val1]) VALUES (@Val1_P)', @Val1_P=default

First, why is the server giving the error about parameter not supplied? I have supplied it, and the value is keyword default.

Then I try to change the query to setting @Val1_P=null. This works..

BUT the problem then is, how do I set this from ADO Command object? I have set the parameter to DbNull.Value, and it translate it to 'default'.. What's going on here? I wanted the parameter to be the keyword 'null' not 'default'.

Any suggestions? Thank you in advance!

SQLServer Error: 15404 with Active Directory



I'm having trouble running jobs with my active directory (ADS) account. I've setup my SQL services to run under an ADS account, but jobs cannot seem to query ADS for user information. We're running Windows Server 2003 and SQL Server 2005 SP2.

 Here is the error message:


The job failed.  Unable to determine if the owner (ADS\me) of job eFASRtest has server access (reason: Could not obtain information about Windows NT group/user 'ADS\me', error code 0x5. [SQLSTATE 42000] (Error 15404)).



also this message in log:


[298] SQLServer Error: 15404, Could not obtain information about Windows NT group/user 'ADS\me, error code 0x5. [SQLSTATE 42000] (ConnIsLoginSysAdmin)



I have done a *lot* of searching and cannot find the solution. I believe the 0x5 code is access denied. 

The same job runs if I change the owner to a SQL login that's not an ADS account.

I'm not certain how to confirm that the SQL Agent account is the account actually querying ADS, also.

Any help would be greatly appreciated!





Microsoft SqlServer 2008 Management SqlStudio Error


I am just installed SqlServer 2008 and then i am getting error when i am exploring server in Management Studio

OS Windows 7 Home Premium.

I and then when i am lunched Management studio there am getting popup window with the willowing error:

Value cannot be null.
Parameter name: viewInfo (Microsoft.SqlServer.Management.SqlStudio.Explorer)

Here is detailed information of this error:


Value cannot be null.
Parameter name: viewInfo (Microsoft.SqlServer.Management.SqlStudio.Explorer)

Program Location:

at Microsoft.SqlServer.Management.SqlStudio.Explorer.ExplorerViewDescriptor..ctor(IFactoryService factoryService, INavigationViewInfo viewInfo, String urnPath, IDictionary`2 allEntities)
at Microsoft.SqlServer.Management.SqlStudio.Explorer.NavigationService.GetView(String urnPath)
at Microsoft.SqlServer.Management.UI.VSIntegration.ObjectExplorer.NavigableItemBuilder.<GetColumnsFromNavigationService>d__f.MoveNext()
at Microsoft.SqlServer.Management.UI.VSIntegration.ObjectExplorer.NavigableItemBuilder.AddFields(List`1 list, IEnumerable`1 fields, IDictionary`2 allValidFields, AddFieldsFlags flags)
at Microsoft.SqlServer.Management.UI.VSIntegration.ObjectExplorer.NavigableItemBuilder.GetF

Error in P2P t-log replication in mix env of 2k5 and 2k8 SQLServer


We have a case where we&nbsp;upgrade SQL server cluster from 2005 to 2008 which also particapates in replication as well.

Svr-1 & Svr-2 are in T-log rep (Pier-1)
Svr-3 & Svr-4 are in T-log rep (Pier-2)
Pier-1 and Pier-2 are clustered pair.
Svr-1 Post upgrade to 2008 NO issues.
Srv-2 Post upgrade to 2008, I am getting the error.

Please suggest any solutions.


ERROR as below -

Error -
TITLE: Microsoft SQL Server Management Studio

Microsoft SQL Server Management Studio could not reinitialize subscription 'SUSDCVM01:Directory'.

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=10.50.1600.1&EvtSrc=Microsoft.SqlServer.Management.UI.ReplicationDialogErrorSR&EvtID=CantReinitSubscription&LinkId=20476


An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)


sqlserver timeout error - corrected by server reboot - how determine cause?


I was gettting multiple timeout errors when submitting changes ( linq to sql ) to my sql server database. This problem occured out of the blue on an app I am coding and testing. Rebooting the client did not correct it. But, rebooting the server did make the problem go away. 

How do I determine what caused the problem. If it happens again, how do I reset things without having to reboot the server?

I am windows server 2008 r2, sql server 2008, VS2010.



Microsoft.SqlServer.Management.Sdk Error


I have a SQL Server 2000 database.  I am trying to ssetup a sqldatasource in Visual Web Developer 2008 Express.  I get an error saying "Microsoft.SqlServer.Management.Sdk.Sfc cannot be loaded".  Everything I can find says this is related to 2005 or 2008.  Any ideas what I can look for?




CLR Stored Proceudre Error in SqlServer 2005



I am trying to write event log through "CLR Stored Proceudre " but it is throwing the follwing exception.





public static void HelloWorld()



SqlContext.Pipe.Send("Hello World from SQLCLR !!");

Error in connecting to SQLServer 2005 from Management studio and neither able to start sql service


I had been using SQL server 2005 without any problem but a few days back I started having some problem with my Windows XP Professional sp2 that my pc used to go off after 5-7 mins everytime i started it. So I repaired the OS. Since then,when i opened SQL Server and tried to connect am getting this error---

TITLE: Connect to Server

Cannot connect to POONAM-C586A95C\SQLEXPRESS.


A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified) (Microsoft SQL Server, Error: -1)

I checked the state of sql serverand it is stopped. What should I do to bring it to running state?

I even added sqlservr exe file to the exceptions in the firewall but i dont think that could hav been a problem b'coz it was working perfectly without any changes in the firewall setting.

Why am I getting this error and how can I remove it?

Please help.

How to Encrypt and Decrypt a Password using SQLSERVER 2005?(Video)

Encypt and Decrypt a Password using SQLSERVER 2005(Video)

Date and Time Functions in SQLSERVER

Date and time functions allow you to manipulate columns and variables with DATETIME and SMALLDATETIME data types.

1 DATEPART Function
2 DATENAME Function
3 DAY, MONTH, and YEAR Functions
5 DATEADD Functions
6 DATEDIFF Function
7 More SQL Server Functions

Data Types - Date and Time in SqlServer

Date and time values can be stored with either the DATETIME or SMALLDATETIME data type. The difference between the two is that SMALLDATETIME supports a smaller range of dates and does not give the same level of precision when accounting for time. The DATETIME data type can hold values from January 1st of 1753 to December 31st of 9999. The time is stored to the 1 three hundredths of a second and each value takes up 8 bytes of storage. The SMALLDATETIME data type can hold values between January 1st 1900 and June 6th of 2079. The time is tracked to the minute and each value takes up 4 bytes of storage. The majority of business applications can live happily with SMALLDATETIME, however, if you are in an environment where each second matters or you need to make estimates to the distant future (or past) then you have to resort to DATETIME. If you fail to specify the time when inserting a value into a DATETIME or SMALLDATETIME column, a default of midnight is used. If you fail to specify the date portion the default of January 1, 1900 is used.

IsapiModule Error 500 Issue


I am about exhausted trying to figure out this error:

HTTP Error 500.0 - Internal Server Error

Description: The page cannot be displayed because an internal server error has occurred.

Error Code: 0x8007007b

Notification: ExecuteRequestHandler

Module: IsapiModule

Requested URL: http://localhost:80/ReportServer

Physical Path: c:\Program Files\Microsoft SQL Server\MSSQL.2\Reporting Services\ReportServer

When I enable Failed Request Tracing Rules and view the log output I am supposing that the actual problem is in the 2nd call where there are 2 backslashes before the actual filename in the specified path:


CALL_ISAPI_EXTENSION DllName="C:\Windows\Microsoft.NET\Framework\v2.0.50727\\aspnet_isapi.dll"

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend