469,607 Members | 1,882 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,607 developers. It's quick & easy.

whats problem in asp.net 2.0

I has web project on virtual pc, maked with framework 2.0. there I was used
the method role.roleexists("admin") and everything was worked good.
but when i replace this project on my local machine, where is installed both
versions 1.1 and 2.0 of framework. And on the this method I am getting the
error
System.Web.HttpException was unhandled by user code
ErrorCode=-2147467259
Message="Unable to connect to SQL Server database."
Source="System.Web"
StackTrace:
at System.Web.DataAccess.SqlConnectionHelper.CreateMd fFile(String
fullFileName, String dataDir, String connectionString)
at
System.Web.DataAccess.SqlConnectionHelper.EnsureSq lExpressDBFile(String
connectionString)
at System.Web.DataAccess.SqlConnectionHelper.GetConne ction(String
connectionString, Boolean revertImpersonation)
at System.Web.Security.SqlRoleProvider.RoleExists(Str ing roleName)
at System.Web.Security.Roles.RoleExists(String roleName)
at Login.Login1_Authenticate(Object sender, AuthenticateEventArgs e)
in C:\WebSites\MedInfo\Login.aspx.vb:line 29
at
System.Web.UI.WebControls.Login.OnAuthenticate(Aut henticateEventArgs e)
at System.Web.UI.WebControls.Login.AttemptLogin()
at System.Web.UI.WebControls.Login.OnBubbleEvent(Obje ct source,
EventArgs e)
at System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs
args)
at System.Web.UI.WebControls.Button.OnCommand(Command EventArgs e)
at System.Web.UI.WebControls.Button.RaisePostBackEven t(String
eventArgument)
at
System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEventHandler.RaisePostBackEvent(String
eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler
sourceControl, String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection
postData)
at System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
Whats wrong
Jan 9 '06 #1
3 1647
Vaidas Gudas wrote:
I has web project on virtual pc, maked with framework 2.0. there I was used
the method role.roleexists("admin") and everything was worked good.
but when i replace this project on my local machine, where is installed both
versions 1.1 and 2.0 of framework. And on the this method I am getting the
error
System.Web.HttpException was unhandled by user code
ErrorCode=-2147467259
Message="Unable to connect to SQL Server database."
Source="System.Web"
StackTrace:
at System.Web.DataAccess.SqlConnectionHelper.CreateMd fFile(String
fullFileName, String dataDir, String connectionString)
at
System.Web.DataAccess.SqlConnectionHelper.EnsureSq lExpressDBFile(String
connectionString)
at System.Web.DataAccess.SqlConnectionHelper.GetConne ction(String
connectionString, Boolean revertImpersonation)
at System.Web.Security.SqlRoleProvider.RoleExists(Str ing roleName)
at System.Web.Security.Roles.RoleExists(String roleName)
at Login.Login1_Authenticate(Object sender, AuthenticateEventArgs e)
in C:\WebSites\MedInfo\Login.aspx.vb:line 29
at
System.Web.UI.WebControls.Login.OnAuthenticate(Aut henticateEventArgs e)
at System.Web.UI.WebControls.Login.AttemptLogin()
at System.Web.UI.WebControls.Login.OnBubbleEvent(Obje ct source,
EventArgs e)
at System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs
args)
at System.Web.UI.WebControls.Button.OnCommand(Command EventArgs e)
at System.Web.UI.WebControls.Button.RaisePostBackEven t(String
eventArgument)
at
System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEventHandler.RaisePostBackEvent(String
eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler
sourceControl, String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection
postData)
at System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
Whats wrong

The error message is quite descriptive really: "Unable to connect to SQL
Server database".

Make sure it's up and running fine, that you have a valid connection
string, and that ASP.Net is configured properly (i.e. machine.config and
all)
Jan 9 '06 #2
it is using sql server 2000 and it is working.
code fragment:
Dim sqlConn As New
SqlConnection(System.Configuration.ConfigurationMa nager.ConnectionStrings("MedInfoConnectionString") .ToString)

Dim sqlCmd As SqlCommand

Dim sqlDR As SqlDataReader

sqlConn.Open()

sqlCmd = sqlConn.CreateCommand

sqlCmd.CommandText = "SELECT dbo.PERSONALAS.PAVARDE, dbo.PERSONALAS.VARDAS,
dbo.Grupes.Pavadinimas, dbo.PERSONALAS.VARTOTOJAS,
dbo.PERSONALAS.SLAPTAZODIS,dbo.PERSONALAS.K_SKYRIU S " & _

"FROM dbo.Grupes INNER JOIN dbo.PERSONALAS ON dbo.Grupes.K_Grupe =
dbo.PERSONALAS.GRUPE where vartotojas='" & Me.Login1.UserName & "' and
slaptazodis='" & Me.Login1.Password & "'"

sqlDR = sqlCmd.ExecuteReader

If Not sqlDR.HasRows Then

Login1.FailureAction = LoginFailureAction.Refresh

Else

sqlDR.Read()

Session("skyrius_id") = sqlDR("K_SKYRIUS")

If Not Roles.RoleExists(sqlDR("Pavadinimas").ToString) Then

......

on the Roles.RoleExists(sqlDR("Pavadinimas").ToString I am getting the error

"john smith" <jo**@smith.com> wrote in message
news:%2*****************@TK2MSFTNGP15.phx.gbl...
Vaidas Gudas wrote:
I has web project on virtual pc, maked with framework 2.0. there I was
used the method role.roleexists("admin") and everything was worked good.
but when i replace this project on my local machine, where is installed
both versions 1.1 and 2.0 of framework. And on the this method I am
getting the error
System.Web.HttpException was unhandled by user code
ErrorCode=-2147467259
Message="Unable to connect to SQL Server database."
Source="System.Web"
StackTrace:
at System.Web.DataAccess.SqlConnectionHelper.CreateMd fFile(String
fullFileName, String dataDir, String connectionString)
at
System.Web.DataAccess.SqlConnectionHelper.EnsureSq lExpressDBFile(String
connectionString)
at System.Web.DataAccess.SqlConnectionHelper.GetConne ction(String
connectionString, Boolean revertImpersonation)
at System.Web.Security.SqlRoleProvider.RoleExists(Str ing roleName)
at System.Web.Security.Roles.RoleExists(String roleName)
at Login.Login1_Authenticate(Object sender, AuthenticateEventArgs
e) in C:\WebSites\MedInfo\Login.aspx.vb:line 29
at
System.Web.UI.WebControls.Login.OnAuthenticate(Aut henticateEventArgs e)
at System.Web.UI.WebControls.Login.AttemptLogin()
at System.Web.UI.WebControls.Login.OnBubbleEvent(Obje ct source,
EventArgs e)
at System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs
args)
at System.Web.UI.WebControls.Button.OnCommand(Command EventArgs e)
at System.Web.UI.WebControls.Button.RaisePostBackEven t(String
eventArgument)
at
System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEventHandler.RaisePostBackEvent(String
eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler
sourceControl, String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection
postData)
at System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
Whats wrong

The error message is quite descriptive really: "Unable to connect to SQL
Server database".

Make sure it's up and running fine, that you have a valid connection
string, and that ASP.Net is configured properly (i.e. machine.config and
all)

Jan 9 '06 #3
Vaidas Gudas wrote:
it is using sql server 2000 and it is working.


The problem isn't with your code or the connection string you're using
there. It's with the Role Provider - by default it's set to
LocalSqlServer - which is configured (default) to a local SQL Express
instance (file aspnetdb.mdf). If you're using SQL Server 2000 instead
you have to config this for things to work (same for other providers).
Jan 9 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

9 posts views Thread by cricketunes | last post: by
3 posts views Thread by Kevin Steffer | last post: by
2 posts views Thread by SOR | last post: by
3 posts views Thread by Chris Geerdink | last post: by
4 posts views Thread by David Lozzi | last post: by
4 posts views Thread by sophie | last post: by
7 posts views Thread by Paulo | last post: by
reply views Thread by guiromero | last post: by
reply views Thread by devrayhaan | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.