Showing posts with label attempt. Show all posts
Showing posts with label attempt. Show all posts

Thursday, March 22, 2012

cannot deploy analysis services tutorial db

i am using sql server developer 2005 .... i follow a tutorial example and attempt to deploy a created analysis services project to the analysis server .... but when i attempt to deploy i get the following:

Error 1 The following system error occurred: Key not valid for use in specified state. . 0 0

i have looked a bunch of different places and found references to this error and have tried things like deleting & creating a new data connection but this does not have any effect .... also these references i have found on the web dont look like they matche my particular situation (deploying to the analysis server) ..... does anyone know how I can get around this ? unfortunately i have not been sucessful in executing the most rudimentary task in sql server ...

thanks

Daver, this error message typically appears in scenarios where the SQL Server Analysis Services service account has been changed to Local Service or if there was an inappropriate change in the service startup account. Can you run your AS service as "Local System" or some valid domain user that has permissions to the relational database referenced in your project’s data source? To change the service account, please use the SQL Server Configuration Manager utility that ships with the product.

Hope this helps,

Artur

sql

Wednesday, March 7, 2012

Cannot Convet Sql image to Byte[]

I have followed many examples found on this site, but still get an invalid cast execption when I attempt to run code below. the exception is thrown when I try to convert the sql image to a byte[] in the download section of the code.


//
// sqlUploadImage
//
this.sqlUploadImage.CommandText = "INSERT INTO Image_Table (Description, Type, Lenth, DocName) VALUES (@.Description," +
" @.Type, @.Length, @.DocName)";
this.sqlUploadImage.Connection = this.sqlConnection2;
this.sqlUploadImage.Parameters.Add(new System.Data.SqlClient.SqlParameter("@.Description", System.Data.SqlDbType.VarChar, 50, "Description"));
this.sqlUploadImage.Parameters.Add(new System.Data.SqlClient.SqlParameter("@.Type", System.Data.SqlDbType.VarChar, 50, "Type"));
this.sqlUploadImage.Parameters.Add(new System.Data.SqlClient.SqlParameter("@.Length", System.Data.SqlDbType.Int, 4, "Lenth"));
this.sqlUploadImage.Parameters.Add(new System.Data.SqlClient.SqlParameter("@.DocName", System.Data.SqlDbType.VarChar, 50, "DocName"));
this.sqlUploadImage.Parameters.Add(new System.Data.SqlClient.SqlParameter("@.Image", System.Data.SqlDbType.Image, 16, "ImgField"));
this.Button2.Click += new System.EventHandler(this.Button2_Click);
//
// sqlDownLoadImage
//
this.sqlDownLoadImage.CommandText = "SELECT Image_Table.* FROM Image_Table";
this.sqlDownLoadImage.Connection = this.sqlConnection2;

//upload file
private void Button1_Click(object sender, System.EventArgs e)
{
//Get the filename of the pdf file to be uploaded.
string strFilename = File1.PostedFile.FileName.Substring(File1.PostedFile.FileName.LastIndexOf("\\") +1);

//Get the file type
string strFileType = File1.PostedFile.ContentType;

//Get the file size
int intImageSize = File1.PostedFile.ContentLength;

// Reads the Image
Stream ImageStream = File1.PostedFile.InputStream;

byte[] ImageContent = new byte[intImageSize + 1];
int intStatus = 0;
intStatus = ImageStream.Read(ImageContent, 0, intImageSize);

//Response.Write(strFilename.ToString());
//Response.Write("<br>Image Type: " + strFileType.ToString());
//Response.Write("<br>Image Size: "+intImageSize.ToString());

this.sqlUploadImage.Parameters["@.Description"].Value = strFilename;
this.sqlUploadImage.Parameters["@.Type"].Value = strFileType;
this.sqlUploadImage.Parameters["@.Length"].Value = intImageSize;
this.sqlUploadImage.Parameters["@.DocName"].Value = "TestPDF";
this.sqlUploadImage.Parameters["@.Image"].Value = ImageContent;

try
{
this.sqlConnection2.Open();
this.sqlUploadImage.ExecuteNonQuery();

this.Label2.Text = "File Uploaded Successfully";
this.Button2.Visible = true;
}
catch(SqlException ex)
{
Response.Write(ex.ToString());
}
finally
{
this.sqlConnection2.Close();
}
}

//download file
private void Button2_Click(object sender, System.EventArgs e)
{
try
{
this.sqlConnection2.Open();
SqlDataReader r = this.sqlDownLoadImage.ExecuteReader(CommandBehavior.CloseConnection);

if(r.Read())
{

Response.ContentType = r["Type"].ToString();
byte[] image = (byte[])r["ImgField"];
Response.BinaryWrite(image);
}
}
catch(SqlException ex)
{
Response.Write(ex.ToString());
}
finally
{
this.sqlConnection2.Close();
}
}

I am somewhat confused because the INSERT statement for your upload process only contains 4 parameters (even though 5 parameters are specified). So my guess is that the image is not gettng into the database (and is therefore NULL), and that is why you are getting the exception on the download portion?

Terri|||Thanks for the reply, but there are 5 parameters.

I have double check the database and all information is there for the upload and all information is valid.

The problem is on the download.

byte[] image = (byte[])r["ImgField"];

throughs an invalid cast.... I have found many articles using this exact cast.|||HOly cow, I see it now.

only 4 parameters.

let me see if i change itl|||ok fixed my insert string.

Now I have verifity there is nothing being uploaded to hte ImgField... it is DBNULL.|||Why are you adding 1 to the image file size when dimensioning the byte array? I thought the size of the byte array should match the file size?


byte[] ImageContent = new byte[intImageSize];

Terri|||Yes, fixed that also.

Ok it uploads now.

BUT, when I download I get just the binary information to output. And it doesn't output on in the browser but in a new webform.

any ideas?

Updated code here


//
// sqlConnection2
//
this.sqlConnection2.ConnectionString = ((string)(configurationAppSettings.GetValue("sqlConnection2.ConnectionString", typeof(string))));
//
// sqlDownLoadImage
//
this.sqlDownLoadImage.CommandText = "SELECT Image_Table.* FROM Image_Table";
this.sqlDownLoadImage.Connection = this.sqlConnection2;
//
// sqlCommand1
//
this.sqlCommand1.CommandText = "SELECT ImgField, Type FROM Image_Table WHERE (ImageID = 1)";
this.sqlCommand1.Connection = this.sqlConnection2;
this.Load += new System.EventHandler(this.Page_Load);

}
#endregion

//upload file
private void Button1_Click(object sender, System.EventArgs e)
{
//Get the filename of the pdf file to be uploaded.
string strFilename = File1.PostedFile.FileName.Substring(File1.PostedFile.FileName.LastIndexOf("\\") +1);

//Get the file type
string strFileType = File1.PostedFile.ContentType;

//Get the file size
int intImageSize = File1.PostedFile.ContentLength;

//Reads teh image
Stream imgStream = File1.PostedFile.InputStream;

byte[] ImageContent = new byte[intImageSize];
int intStatus = imgStream.Read(ImageContent, 0, intImageSize);

//Response.Write(strFilename.ToString());
//Response.Write("<br>Image Type: " + strFileType.ToString());
//Response.Write("<br>Image Size: "+intImageSize.ToString());

SqlCommand sqlUpload = new SqlCommand("INSERT INTO Image_Table(Description, ImgField, Type, Lenth, DocName)" +
"VALUES (@.Description, @.Image, @.Type, @.Length, @.DocName)", this.sqlConnection2);

SqlParameter param0 = new SqlParameter("@.Description", SqlDbType.VarChar, 50);
param0.Value = strFilename;
sqlUpload.Parameters.Add( param0 );

SqlParameter param1 = new SqlParameter("@.Image", SqlDbType.Image);
param1.Value = ImageContent;
sqlUpload.Parameters.Add( param1 );

SqlParameter param2 = new SqlParameter("@.Type", SqlDbType.VarChar, 50);
param2.Value = strFileType;
sqlUpload.Parameters.Add( param2 );

SqlParameter param3 = new SqlParameter("@.Length", SqlDbType.Int);
param3.Value = intImageSize;
sqlUpload.Parameters.Add( param3 );

SqlParameter param4 = new SqlParameter("@.DocName", SqlDbType.VarChar, 50);
param4.Value = "Test PDF";
sqlUpload.Parameters.Add( param4 );

try
{
this.sqlConnection2.Open();
sqlUpload.ExecuteNonQuery();

this.Label2.Text = "File Uploaded Successfully";
this.Button2.Visible = true;
}
catch(SqlException ex)
{
Response.Write(ex.ToString());
}
finally
{
this.sqlConnection2.Close();
}
}

//download file
private void Button2_Click(object sender, System.EventArgs e)
{
try
{
this.sqlConnection2.Open();
SqlDataReader r = this.sqlDownLoadImage.ExecuteReader(CommandBehavior.CloseConnection);

if(r.Read())
{
Response.ContentType = r["Type"].ToString();
Response.BinaryWrite((byte[])r["ImgField"]);
Response.
}
}
catch(SqlException ex)
{
Response.Write(ex.ToString());
}
finally
{
this.sqlConnection2.Close();
}
}

|||Ok, if I am working with photos, jpeg, gif etc.. the above code works great. But I need to store and view pdf files and this code is not working for that type of application/pdf

please any ideas?|||I believe you need to use the Response object's AddHeader method in order to get that to work for you. I don't have any direct experience with that, but this post might help:view post 463798

Terri|||Thanks,

I am getting the same results it won't open in a broswer window when I use inline. I would like this to happen, but does this mean i must save the file first to a spot before I can view it.

If that is true, will it be easier for me to just store the pdf's in a file structure on teh server and have teh database store a path to it?

Thanks|||I am having a similar problem

i am trying to use the example at:
http://aspalliance.com/articleViewer.aspx?aId=140

got the upload working

the download is another story though.
when i use the following code i get a conversion issue

Response.BinaryWrite(myDataReader.Item("PersonImage"))

it says that with option strict on, i can not make an implicit conversion from system.object to a 1-dimensional array of Byte.

this is driving me crazy and all the above is way beyond me - as a beginner in this arena|||Instead of this:


Response.BinaryWrite(myDataReader.Item("PersonImage"))

try this:

Response.BinaryWrite(CType(myDataReader.Item("PersonImage"), Byte()))

That should explicitly do the conversion to a byte array.

Terri|||

Terri is a Stud!!!!!!!

That worked FOR ME

Thursday, February 16, 2012

cannot connect to server

i get following error when i attempt to connect to my reporting services server

TITLE: Connect to Server
----------

Cannot connect to RAMA\SQL2005.

----------
ADDITIONAL INFORMATION:

Client found response content type of 'text/html; charset=utf-8', but expected 'text/xml'.
The request failed with the error message:
--
<html>
<head>
<title>
SQL Server Reporting Services
</title><meta name="Generator" content="Microsoft SQL Server Reporting Services 9.00.1399.00" />
<meta name="HTTP Status" content="500" />
<meta name="ProductLocaleID" content="9" />
<meta name="CountryLocaleID" content="1033" />
<meta name="StackTrace" content=" at Microsoft.ReportingServices.Diagnostics.RSConfiguration.Load()
at Microsoft.ReportingServices.Diagnostics.RSConfiguration.Construct(String configFileName)
at Microsoft.ReportingServices.Diagnostics.RSConfiguration..ctor(String configFileName, String location)
at Microsoft.ReportingServices.Diagnostics.RSConfigurationManager..ctor(String configFileName, String configLocation)
at Microsoft.ReportingServices.Library.Global.get_ConfigurationManager()
at Microsoft.ReportingServices.WebServer.Global.StartApp()
at Microsoft.ReportingServices.WebServer.Global.Application_BeginRequest(Object sender, EventArgs e)" />
<style>
BODY {FONT-FAMILY:Verdana; FONT-WEIGHT:normal; FONT-SIZE: 8pt; COLOR:black}
H1 {FONT-FAMILY:Verdana; FONT-WEIGHT:700; FONT-SIZE:15pt}
LI {FONT-FAMILY:Verdana; FONT-WEIGHT:normal; FONT-SIZE:8pt; DISPLAY:inline}
.ProductInfo {FONT-FAMILY:Verdana; FONT-WEIGHT:bold; FONT-SIZE: 8pt; COLOR:gray}
A:link {FONT-SIZE: 8pt; FONT-FAMILY:Verdana; COLOR:#3366CC; TEXT-DECORATION:none}
A:hover {FONT-SIZE: 8pt; FONT-FAMILY:Verdana; COLOR:#FF3300; TEXT-DECORATION:underline}
A:visited {FONT-SIZE: 8pt; FONT-FAMILY:Verdana; COLOR:#3366CC; TEXT-DECORATION:none}
A:visited:hover {FONT-SIZE: 8pt; FONT-FAMILY:Verdana; color:#FF3300; TEXT-DECORATION:underline}

</style>
</head><body bgcolor="white">
<h1>
Reporting Services Error<hr width="100%" size="1" color="silver" />
</h1><ul>
<li>The report server has encountered a configuration error. See the report server log files for more information. (rsServerConfigurationError) </li><ul>
<li>Access to the path 'C:\Program Files\Microsoft SQL Server\MSSQL.2\Reporting Services\ReportServer\RSReportServer.config' is denied.</li>
</ul>
</ul><hr width="100%" size="1" color="silver" /><span class="ProductInfo">SQL Server Reporting Services</span>
</body>
</html>
--. (Microsoft.SqlServer.Management.UI.RSClient)

----------
BUTTONS:

OK
----------
anybody plz help me on this regard

thanks

Rama

I have a similar problem. I can't log into SQL Server's "Connect to Server" dialog box for RS 2005.
Here is the error: (Mine differs from your message above in that the content= in my <HEAD> section is "Microsoft SharePoint" and comes from some sort of webpart markup.)
I am running WSS 3.0/MOSS 2007 on the same server as SQL (configured as a web farm), and I apologize if this is the wrong forum for this type of error.
We have been unsuccessful installing SQL SP2. Also we have been installing and uninstalling the RS Add-In for SQL 2005 and SharePoint. Either way it gives this message.
I would like to know if these error messages (yours and mine) are related.

===================================

Cannot connect to GRANITE.

===================================

Client found response content type of 'text/html; charset=utf-8', but expected 'text/xml'.
The request failed with the error message:
--
<HTML dir="ltr">
<HEAD><meta name="GENERATOR" content="Microsoft SharePoint" /><meta name="progid" content="SharePoint.WebPartPage.Document" /><meta HTTP-EQUIV="Content-Type" content="text/html; charset=utf-8" /><meta HTTP-EQUIV="Expires" content="0" /><meta name="ROBOTS" content="NOHTMLINDEX" /><title>

Error

</title><link rel="stylesheet" type="text/css" href="http://links.10026.com/?link=http://forums.asp.net/_layouts/1033/styles/core.css?rev=5msmprmeONfN6lJ3wtbAlA%3D%3D"/>
<script type="text/javascript" language="javascript" src="http://pics.10026.com/?src=http://forums.asp.net/_layouts/1033/init.js?rev=VhAxGc3rkK79RM90tibDzw%3D%3D"></script>
<script type="text/javascript" language="javascript" src="http://pics.10026.com/?src=http://forums.asp.net/_layouts/1033/core.js?rev=F8pbQQxa4zefcW%2BW9E5g8w%3D%3D"></script>

<meta name="Robots" content="NOINDEX " />
<meta name="SharePointError" content=""/>
</HEAD>
<BODY scroll="yes" onload="javascript:if (typeof(_spBodyOnLoadWrapper) != 'undefined') _spBodyOnLoadWrapper();">
<form name="aspnetForm" method="post" action="../_layouts/error.aspx" id="aspnetForm" onsubmit="return _spFormOnSubmitWrapper();">
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUKLTU2NjkxODU3M2Rkb2yywuhbZFAoLD8RXkk3J2xB2Dw=" />

<TABLE class="ms-main" CELLPADDING=0 CELLSPACING=0 BORDER=0 WIDTH="100%" HEIGHT="100%">
<tr><td>
<table CELLPADDING=0 CELLSPACING=0 BORDER=0 WIDTH="100%">
<tr>
<td colspan=4 class="ms-globalbreadcrumb" align="right">
<a href="http://links.10026.com/?link=javascript:TopHelpButtonClick('NavBarHelpHome')" id="ctl00_PlaceHolderGlobalNavigation_TopHelpLink" AccessKey="6" title="Help (new window)"><img src="http://pics.10026.com/?src=http://forums.asp.net/_layouts/images/helpicon.gif" align="absmiddle" border="0" alt="Help (new window)" /></a>
</td>
</tr>
</table>
</td></tr>
<tr>
<td class="ms-globalTitleArea">
<table width=100% cellpadding=0 cellspacing=0 border=0>
<tr>
<td id="GlobalTitleAreaImage" class="ms-titleimagearea"><img id="onetidHeadbnnr0" src="http://pics.10026.com/?src=http://forums.asp.net/_layouts/images/titlegraphic.gif" alt="" /></td>
<td class="ms-sitetitle" width=100%>


</td>
<td style="padding-top:8px;" valign=top>


</td>
</tr>
</table>
</td>
</tr>
<TR>
<TD id="onetIdTopNavBarContainer" WIDTH=100% class="ms-bannerContainer">


</TD>
</TR>




<TR height="100%"><TD><TABLE width="100%" height="100%" cellspacing="0" cellpadding="0">
<tr>
<td class="ms-titlearealeft" id="TitleAreaImageCell" valign="middle" nowrap><div style="height:100%" class="ms-titleareaframe"></div></td>
<td class="ms-titleareaframe" id="TitleAreaFrameClass">

<table cellpadding=0 height=100% width=100% cellspacing=0>
<tr><td class="ms-areaseparatorleft"><IMG src="http://pics.10026.com/?src=http://forums.asp.net/_layouts/images/blank.gif" width=1 height=1 alt=""></td></tr>
</table>

</td>
<td valign=top id="onetidPageTitleAreaFrame" class='ms-areaseparator' nowrap width="100%">
<table id="onetidPageTitleAreaTable" cellpadding=0 cellspacing=0 width=100% border="0">
<tr>
<td valign="top" class="ms-titlearea">

<a href="http://links.10026.com/?link=http://forums.asp.net/" id="ctl00_PlaceHolderTitleBreadcrumb_idSimpleGoBackToHome">Go back to site</a>

</td>
</tr>
<tr>
<td height=100% valign=top ID=onetidPageTitle class="ms-pagetitle">
<h2 class="ms-pagetitle">

Error

</h2>
</td>
</tr>
</table>
</td>
<td class="ms-titlearearight">


<div class='ms-areaseparatorright'><IMG src="http://pics.10026.com/?src=http://forums.asp.net/_layouts/images/blank.gif" width=8 height=100% alt=""></div>
</td>
</tr>

<TR>
<TD class="ms-leftareacell" valign=top height=100% id="LeftNavigationAreaCell">
<table class=ms-nav width=100% height=100% cellpadding=0 cellspacing=0>
<tr>
<td>
<TABLE height="100%" class=ms-navframe CELLPADDING=0 CELLSPACING=0 border="0">
<tr valign="top">
<td width="4px"><IMG src="http://pics.10026.com/?src=http://forums.asp.net/_layouts/images/blank.gif" width=4 height=1 alt=""></td>
<td valign="top" width="100%">







</td>
</tr>
<tr><td colspan=2><IMG src="http://pics.10026.com/?src=http://forums.asp.net/_layouts/images/blank.gif" width=138 height=1 alt=""></td></tr>
</TABLE>
</td>
<td></td>
</tr>
</table>
</TD>
<td>
<div class='ms-areaseparatorleft'><IMG src="http://pics.10026.com/?src=http://forums.asp.net/_layouts/images/blank.gif" width=8 height=100% alt=""></div>
</td>
<td class='ms-formareaframe' valign="top">
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0" class="ms-propertysheet">
<TR valign="top" >
<TD class="ms-descriptiontext" width="100%">

</TD>
<TD ID=onetidYPadding width="10px"><IMG src="http://pics.10026.com/?src=http://forums.asp.net/_layouts/images/blank.gif" width=10 height=1 alt=""></TD>
</TR>
<TR >
<TD ID=onetidMainBodyPadding height="8px"><IMG src="http://pics.10026.com/?src=http://forums.asp.net/_layouts/images/blank.gif" width=1 height=8 alt=""></TD>
</TR>
<tr>
<td valign="top" height="100%">
<A name="mainContent"></A>

<table width=100% border=0 class="ms-titleareaframe" cellpadding=0>
<TR>
<TD valign=top width="100%" style="padding-top: 10px" class="ms-descriptiontext">
<span id="ctl00_PlaceHolderMain_LabelMessage">File Not Found.</span>
<P><span class="ms-descriptiontext">
<span id="ctl00_PlaceHolderMain_helptopic_troubleshooting"><A Title="Troubleshoot issues with Windows SharePoint Services. - Opens in new window" href="http://links.10026.com/?link=javascript:HelpWindowKey('troubleshooting')">Troubleshoot issues with Windows SharePoint Services.</A></span>

</span>
</TD>
</TR>
</table>
<script type="text/javascript" language="JavaScript">
var gearPage = document.getElementById('GearPage');
if(null != gearPage)
{
gearPage.parentNode.removeChild(gearPage);
document.title = "Error";
}
</script>

</td>
</tr>
</table>
</td>
<td class="ms-rightareacell">
<div class='ms-areaseparatorright'><IMG src="http://pics.10026.com/?src=http://forums.asp.net/_layouts/images/blank.gif" width=8 height=100% alt=""></div>
</td>
</TR>
<tr>
<td class="ms-pagebottommarginleft"><IMG src="http://pics.10026.com/?src=http://forums.asp.net/_layouts/images/blank.gif" width=1 height=10 alt=""></td>
<td class="ms-pagebottommargin"><IMG src="http://pics.10026.com/?src=http://forums.asp.net/_layouts/images/blank.gif" width=1 height=10 alt=""></td>
<td class="ms-bodyareapagemargin"><IMG src="http://pics.10026.com/?src=http://forums.asp.net/_layouts/images/blank.gif" width=1 height=10 alt=""></td>
<td class="ms-pagebottommarginright"><IMG src="http://pics.10026.com/?src=http://forums.asp.net/_layouts/images/blank.gif" width=1 height=10 alt=""></td>
</tr>
</TABLE></TD></TR>
</TABLE>


<input type="text" name="__spDummyText1" style="display:none;" size=1/>
<input type="text" name="__spDummyText2" style="display:none;" size=1/>
</form>

</BODY>
</HTML>

--. (Microsoft.SqlServer.Management.UI.RSClient)

----------
Program Location:

at Microsoft.SqlServer.ReportingServices2005.RSConnection.GetSecureMethods()
at Microsoft.SqlServer.ReportingServices2005.RSConnection.IsSecureMethod(String methodname)
at Microsoft.SqlServer.ReportingServices2005.RSConnection.ValidateConnection()
at Microsoft.SqlServer.Management.UI.RSClient.RSClientConnection.CreateConnection(String connectionString)
at Microsoft.SqlServer.Management.UI.RSClient.RSConnectionInfo.CreateConnectionObject()
at Microsoft.SqlServer.Management.UI.RSClient.RSConnectionInfo.RSTypeImpl.GetConnectionObject(UIConnectionInfo ci)
at Microsoft.SqlServer.Management.UI.ConnectionDlg.RSType.GetConnectionObject(UIConnectionInfo ci)
at Microsoft.SqlServer.Management.UI.VSIntegration.ObjectExplorer.ObjectExplorer.ValidateConnection(UIConnectionInfo ci, IServerType server)
at Microsoft.SqlServer.Management.UI.ConnectionDlg.Connector.ConnectionThreadUser()

cannot connect to server

i have installed SQL Server management studio
when i attempt to connect to report services server i get the following error

client found response content type text/html;expected text/xml

i cant find where i might have went wrong in installation or report server configuration
am new to reporting services so plz help me on this regard

thanks
sallyAre you sure SQL Server Reporting Services is running smootly at the connecting server ? To make sure that it is, connect to the server using http://Yourserver/Reportserver (or the non-default name you configured for it) I guess you are trying to connect, the IIS throws an error message (which is in HTML) and which is not readable for SSMS.

Jens K. Suessmeyer.

http://www.sqlserver2005.de
|||

Reporting Services Error

The report server has encountered a configuration error. See the report server log files for more information. (rsServerConfigurationError) Access to the path 'C:\Program Files\Microsoft SQL Server\MSSQL.2\Reporting Services\ReportServer\RSReportServer.config' is denied.|||This is a security related problem of the Windows Server or the IIS Worker process, see more details here:

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

Jens K. Suessmeyer.

http://www.sqlserver2005.de