Showing posts with label ive. Show all posts
Showing posts with label ive. Show all posts

Friday, March 30, 2012

problem with local connection

I've just installed VS .NET 2005 and also installed sql Express that come along with it
when I tried to run a simple web page wih gridview that connect to the sql express with the table that I create and test it
status is "Tested connection suceeded" or test query is also successful but when I run I got the following message please help

-----------------------

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

Description:An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details:System.Data.SqlClient.SqlException: Cannot open database "customers" requested by the login. The login failed.
Login failed for user 'USFER54-8B481CE\ASPNET'.

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 identified using the exception stack trace below.


Stack Trace:

[SqlException (0x80131904): Cannot open database "customers" requested by the login. The login failed.Login failed for user 'USFER54-8B481CE\ASPNET'.] System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +739123 System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +188 System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +1956 System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK) +33 System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnection owningObject) +170 System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(String host, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, Int64 timerStart) +349 System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) +181 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) +359 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.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1360

Thanks in advance for your help

ASPNet ('USFER54-8B481CE\ASPNET') user is not having access to the database. You can add ASPNet user to this database using management studio and then try accessing the site.

You can also try accessing the site using SQL Server User instead of Windows User.

sql

Monday, March 26, 2012

Problem with Install of MSSQL 2005 Standard x64 on two node cluster

Hi:
I'm trying to install MS SQL 2005 Standard x64 to a two node Windows Server
2003 R2 SP2 cluster.
I've setup the cluster as per MS requirements and tested failover, The
cluster seems to be working well.
When I go through the Install and select failover clustering for the
Database and Analysis services, all seems to go well until it gets to the
end, I get a failure on the second (passive) node.
On the passive node I find that there is a Task Scheduler job set, SQL
Server Remote Setup.job that is reporting this error:
"SQL Server Remote Setup .job" (setup.exe) 12/4/2007 12:40:14 PM ** ERROR
**
Unable to start task.
The specific error is:
0x80070005: Access is denied.
Try using the Task page Browse button to locate the application.
The only MS info, I've found is not to be in RDP on the second node. I've
tried that and even did an install from the console on the first node (No
Remote Desktop sessions at all). Same error.
I've made sure that the account used is part of the local administrators
group on both nodes and has the following rights:
Act as part of operating system
Logon as a batch job
Logon as a Service
I have been going around on this for several days and cannot come to a
solution.
Is it that the second node doesn't have access to the setup files? I tried
installing from the DVD on the primary node and copied the files to a
directory on the primary and shared it. Same error.
Thanks
Usually, the last thing you tried, moving the setup files, fixes this type
of issue.
Have you tried running the cluster install but only for the first node, then
adding the node via add/remove programs? I sometimes find mirroring the
regular cluster setup logic (build a single-node cluster and add on) helps.
Geoff N. Hiten
Senior SQL Infrastructure Consultant
Microsoft SQL Server MVP
"Paul Hons" <Paul.Hons@.unt.edu> wrote in message
news:4755520A.B695.00E7.0@.unt.edu...
> Hi:
> I'm trying to install MS SQL 2005 Standard x64 to a two node Windows
> Server
> 2003 R2 SP2 cluster.
> I've setup the cluster as per MS requirements and tested failover, The
> cluster seems to be working well.
> When I go through the Install and select failover clustering for the
> Database and Analysis services, all seems to go well until it gets to the
> end, I get a failure on the second (passive) node.
> On the passive node I find that there is a Task Scheduler job set, SQL
> Server Remote Setup.job that is reporting this error:
> "SQL Server Remote Setup .job" (setup.exe) 12/4/2007 12:40:14 PM ** ERROR
> **
> Unable to start task.
> The specific error is:
> 0x80070005: Access is denied.
> Try using the Task page Browse button to locate the application.
> The only MS info, I've found is not to be in RDP on the second node. I've
> tried that and even did an install from the console on the first node (No
> Remote Desktop sessions at all). Same error.
> I've made sure that the account used is part of the local administrators
> group on both nodes and has the following rights:
> Act as part of operating system
> Logon as a batch job
> Logon as a Service
> I have been going around on this for several days and cannot come to a
> solution.
> Is it that the second node doesn't have access to the setup files? I tried
> installing from the DVD on the primary node and copied the files to a
> directory on the primary and shared it. Same error.
> Thanks
>
>
|||Geoff N. Hiten wrote:
> Usually, the last thing you tried, moving the setup files, fixes this
> type of issue.
> Have you tried running the cluster install but only for the first
> node, then adding the node via add/remove programs? I sometimes find
> mirroring the regular cluster setup logic (build a single-node cluster
> and add on) helps.
>
One other thing to try - which I had to do to get around this issue.
Have you logged into both systems with the service account that you will
be using to run SQL Server? If not, make sure you log into both
machines with that account to create the user profile. For whatever
reason - without the user profile the task scheduler jobs cannot be started.
At least that is what worked for me.
BTW - before you restart your install make sure you uninstall the setup
files or you will get another error.
Jeff

Monday, March 12, 2012

problem with execute.scalar()

Hello,

I've got the following code:

Dim Selected1
Dim cnnAs New Data.SqlClient.SqlConnection(ConfigurationManager.ConnectionStrings("ConnectionString1").ToString())
Dim SqlCommandAs New Data.SqlClient.SqlCommand("SELECT [OKTipp1] FROM [ErsteSchritte] WHERE (User.Name = @.UserName)", cnn)
SqlCommand.Parameters.Add("@.UserName", Data.SqlDbType.VarChar, 30)
SqlCommand.Parameters("@.UserName").Value = User.Identity.Name

cnn.Open()
Selected1 = SqlCommand.ExecuteScalar()
cnn.Close()

MsgBox(Selected1)

Unfortunatly, I am given an error message. What did I do wrong?

Thanks for any suggestions

Regards

What is the exception you are recieving?

|||

Methods for nvarchar could not be called up.

(Methoden für nvarchar k?nnen nicht aufgerufen werden.)

|||

Yikes a German translation! This will be hard. Maybe one of the MSFT admins can chime in on this one. One thing you might want to do is declare your variable as a type. For example.

Dim ret as String

|||

If I do not use the WHERE-clause and the @.username-parameter, everything's fine:

1Dim Selected1As Integer2Dim cnnAs New SqlConnection(ConfigurationManager.ConnectionStrings("ConnectionString1").ToString())3Dim SqlCommandAs New SqlCommand("SELECT [OKTipp1] FROM [ErsteSchritte]", cnn)45cnn.Open()6Selected1 = SqlCommand.ExecuteScalar()7cnn.Close()89MsgBox(Selected1)
But how can I restrict the data to those of the logged in user?|||

First ,make sure your User.Identity.Name actually have value (you can set a break point there);

and second, are you sure we can use SqlCommand.Parameters("@.UserName").Value and there is no compilation errors given? I think sqlcommand.Parameters is a collection and we are using an index here so we should use sqlcommand.parameters["@.UserName"] instead.But anyway,this should not be the point... Pay attention to the User.Identity.Name part, I'm afraid the issue resides there.

Hope my suggestion helps

|||

Hi Mr.MSFT

I'm new to this forum and want to get some help here, since that i've heard some of Microsoft guys are active on this forum.

But for the post above, Bo,

are you sure we can use SqlCommand.Parameters("@.UserName").Value

Are you asking us if we can use the statment above? Hey!!! You are MSFT, it is YOU who should tell us the answer.

I think sqlcommand.Parameters is a collection and we are using an index here so we should use sqlcommand.parameters["@.UserName"] instead

You are suggesting us to use ["@.UserName"] to replace ("@.Username")... oh...MYGOD... ("@.UserName") is in VB.Net... the poster's using VB.NET,not C#..... don't you even know the code in VB way...

Finally..the badest, your reply has been marked as an answer... OHHHHH.... HOW CAN IT BE AN ANSWER? really ... really... disappointed here.

Mr. MSFT, i hope some words like "are you sure we can use..." won't come out from you guys....if you don't know, at least, you should have a test for us since it's not a complicated issue... just setting a parameter agasint the SQLDATASOURCE....

Last, i hope you won't be angry , Mr. MSFT... For us , Microsoft users, we just want a correct and reliable answer.

|||

Hi squall44 and GroovesRojar,

Thanks for all your comments. We are still trying our best to improve the quality of our replies and answers.

First, for the parameters collection issue, we do can useSqlCommand.Parameters("@.UserName").Value in VB.Net although we are getting used to useSqlCommand.Parameters["@.UserName"].Value in C#.

You can refer the samples in following link:
http://msdn2.microsoft.com/en-us/library/system.data.sqlclient.sqlcommand.parameters.aspx

Second, I think the cause of the issue is "User.Name" in your sql statements. If you want to check whether "User.Name" in ASP.Net equals to some user name stored in the table, you should create your sql in the following way:

SELECT [YourField] FROM [YourTable] WHERE ( [YourTable].[UserNameField] = @.UserName)

// Here, You can assign the @.UserName with the value of User.Name propery in ASP.NET

After you modify your sql statement, I suggest that you should run it with a hard-coded parameter in Query Analyzer first to see if it can work. If it can, then add a break point in your application and run it step by step in order to check if any parameters lost during the runtime. In this way, I think you can find the cause of the problem.

I hope that helps.

Thanks.

Monday, February 20, 2012

Problem with DataSet or SQL query

I've faced the following problem while forming DataSet. I'd like to ask the following SQL query:

___

select Users.UserID,Users.FirstName,Users.LastName, Users.Email, data.Suffix, data.Unit,data.Telephone, data.IM,

data.Website
from
(select UserID,
max(case PropertyName when 'Suffix' then PropertyValue end)Suffix,
max(case PropertyName when 'Unit' then PropertyValue end)Unit,
max(case PropertyName when 'Telephone' then PropertyValue end)Telephone,
max(case PropertyName when 'IM' then PropertyValue end)IM,
max(case PropertyName when 'Website' then PropertyValue end)Website
from
(
SELECT UserProfile.UserID, UserProfile.PropertyValue, UserProfile.PropertyDefinitionID,

ProfilePropertyDefinition.PropertyName FROM UserProfile,ProfilePropertyDefinition
WHERE UserProfile.PropertyDefinitionID=ProfilePropertyDefinition.PropertyDefinitionID
)table2
group by UserID)
data
inner join Users on Users.UserID = data.UserID
WHERE data.Suffix = 'IT';

__

Nothing happens while fulfilling as well (i.e. if to set up Breakpoint and watch the DataSet condition - it will be empty there). If to change the request to let's say some standart - then DataSet downloading begins - it seems there's something wrong with the request

I'm checking...If to look with the holp of request master and press "perform", data is reflected in a normal way...But as soon as i press "Bild", emptiness is shown as usual

Please, prompt me what to do

Initial code in the file .aspx.cs:

----------

UserInfo ds =new UserInfo();

UserInfoTableAdapters.UserInformationTableAdapter da =new UserInfoTableAdapters.UserInformationTableAdapter();

da.Fill(ds.UserInformation);

Info.DataSource = ds.UserInformation;

Info.DataBind();

Hello Alag,

Did the query gave the correct result in the SQL Query Analyzer?

If you are using an xsd dataset definition, execute the menu option Preview Data ... to see the xsd dataset works fine.

Jeroen Molenaar.

|||

Result on SQL Query Analyzer is correct.

AND RESULT CORRECT IN "Execute Query" in DataSet Ouery Builder.. But if press "Bild"..((( no correct

|||

Bild sounds like buildSmile, but what error message is the compiler reporting when "bildung".

Jeroen Molenaar.

|||

No error. Just nothing displays on the screen .. And as you see that empty DataSet.

Sorry for the poor English. I am from Russia, and the school taught him poorly.

|||

I thought "bild" was German. But your English is much, much better than my Russian!

Are you indeed using an xsd dataset?

Jeroen Molenaar.

PS: Ja nie gavarjoe paroeskie.

|||

I am using "Add New Item" -> "DataSet"

PS. You russian is good)Smile

|||

In that case you are using an xsd dataset file.

When you open the UserInfo dataset and select the datatable UserInformation. Give a right click on the mouse and select the option: Preview data ... preview.

Does it give any result?

Jeroen Molenaar.

|||

Yes, the results show

|||

We are now moving to the asp page. Can you show more of the code you are using?

Jeroen Molenaar.

|||

Default.aspx.cs:

using System;

using System.Data;

using System.Configuration;

using System.Web;

using System.Web.Security;

using System.Web.UI;

using System.Web.UI.WebControls;

using System.Web.UI.WebControls.WebParts;

using System.Web.UI.HtmlControls;

publicpartialclass_Default : System.Web.UI.Page

{

protectedvoid Page_Load(object sender,EventArgs e)

{

UserInfo ds =newUserInfo();UserInfoTableAdapters.UserInformationTableAdapter da =new UserInfoTableAdapters.UserInformationTableAdapter();

da.Fill(ds.UserInformation);

Info.DataSource = ds.UserInformation;

Info.DataBind();

}

}

|||

Default.aspx

<%@. Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body style="background-color:#F7F7F7">
<form id="form1" runat="server">
<div>

<asp:DataList ID="Info" runat="server">
<ItemTemplate>
<table width="700" border="0" cellpadding="0" cellspacing="2" style="font-family:Tahoma; background-color:white;">
<tr>
<td style="width:130; background-color:#F7F7F7;"><asp:Image ID="Image1" runat="server" ImageUrl='' /></td>
<td valign="top" style="background-color:#F7F7F7"><table width="100%" border="0" cellpadding="0" cellspacing="0" style="background-color:#F7F7F7">
<tr>
<td style=" font-size: 13px;padding-left: 12px;text-decoration:underline;color:#003366;font-weight:bold; height:30px; background:background.png" >
<asp:Label ID="Label7" runat="server"><%# DataBinder.Eval(Container.DataItem, "FirstName")%></asp:Label>
<asp:Label ID="Label8" runat="server"><%# DataBinder.Eval(Container.DataItem, "LastName")%></asp:Label>
</td>
</tr>
<tr>
<td style="height:4px;"></td>
</tr>
...

<tr>
<td style="height:4px;"></td>
</tr>
</table></td>
</tr>
</table>
</ItemTemplate>
</asp:DataList>
</div>
</form>
</body>
</html>

|||

Looks fine to me. Final piece of code: markup language of the default.asp.

Jeroen Molenaar.

PS: Whoah, that was fast!

|||

I don't understand ((.. what I want? The code above is default.aspx

|||

When I was typing my reply, you already added the markup code from default.aspx. My question to add the code was too lateSmile

The problem is propably in the definition of your DataList control on the page, but I don't know exactly. The Data Access/SQL server forum is not a perfect place for this problem.

You better ask your question in another forum about ASP, for example the getting started forum.

Good luck!

Jeroen Molenaar.