Wednesday, March 7, 2012

Error with my request maybe OWC...

Hi, (sorry for my english...)

I have a probelm to build my Pivot table.

Indeed,

The goal is just to see an example of Table Pivot with our Database...

For that, I use this link :

http://www.csharphelp.com/archives4/archive623.html

I try to adapt the code but some problems...

I use visual developper, and i have installed OWC11 & .NET framework 2.0.

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;
using Microsoft.Office.Interop.Owc11;

public partial class _Default : System.Web.UI.Page
{
private void Page_Load(object sender, System.EventArgs e)
{
//determine whether or not the browser supports OWC
if(Request.Browser.ActiveXControls)
{
Response.Write("<OBJECT id='pTable' style='Z-INDEX: 109; LEFT: 8px; WIDTH:502px; POSITION: absolute; TOP: 8px; HEIGHT: 217px' height='217' width='502'classid='clsid:0002E55A-0000-0000-C000-000000000046'VIEWASTEXT></OBJECT>");
//cause the object to load data on the client
Response.Write(@."<script>document.all.pTable.ConnectionString ='" + ConfigurationManager.ConnectionStrings["TimeTrackingDB"] + "'</script>");
Response.Write("<script>document.all.pTable.ResourceID = 'RESOURCE'</script>");

PivotTableClass PTClass = new PivotTableClass();

PTClass.ConnectionString = ConfigurationManager.ConnectionStrings["TimeTrackingDB"].ToString();
PTClass.DataMember = "";
PivotView pview = PTClass.ActiveView;
Response.Write(pview.FieldSets.Count);

}

}
}

When i'm lauching there is an error : HRESULT E_FAIL

http://fists148.free.fr/Error.JPG

If i put the last lines in commentary,

public partial class _Default : System.Web.UI.Page
{
private void Page_Load(object sender, System.EventArgs e)
{
//determine whether or not the browser supports OWC
if(Request.Browser.ActiveXControls)
{
Response.Write("<OBJECT id='pTable' style='Z-INDEX: 109; LEFT: 8px; WIDTH:502px; POSITION: absolute; TOP: 8px; HEIGHT: 217px' height='217' width='502'classid='clsid:0002E55A-0000-0000-C000-000000000046'VIEWASTEXT></OBJECT>");
//cause the object to load data on the client
Response.Write(@."<script>document.all.pTable.ConnectionString ='" + ConfigurationManager.ConnectionStrings["TimeTrackingDB"] + "'</script>");
Response.Write("<script>document.all.pTable.ResourceID = 'RESOURCE'</script>");

}

}
}

The component is loading but it seems to be an issue with the connection database...

In my web.config, I Have this :

<connectionStrings>
<add name="TimeTrackingDB" connectionString="Data Source=PORT06139\DEV_2000;Initial Catalog=TimeTracking;Persist Security Info=True;User ID=user_TTT;Password=user_TTT;pooling=false"/>

</connectionStrings>

Error connection (http://fists148.free.fr/OWCscreen.JPG)

If you have any idea, i take it...I'm deseperate :eek:

Thanks By advanceLets find out whether this is a problem with your pivot tool, or your server connection.
Unfortunately, I can only help you trouble-shoot the connection as I know little or nothing about your application coding.
Are you using SQL Server authentication or Windows authentication to connect to your database server?|||I don't much fancy handling the app code either but... there is an error within the class that is not handled with an exceptioon handler hence you get the call to the property highlighted. Use the debugging tools to step through the code line by line - it will take you through the class and then will error once more at the actual line within the class that is throwing the exception. This might not help us fix the problem but at least let you know if we are capable of fixing the problem or if you need to speak to more .NET enabled people :)|||Thanks for your answer.

Nevertheless I believe it's a problem of SQL..

Indeed, in my web.config, we use this connection string in our overall project and we haven't got any issue with this.

That's why I think there is a mistake in the script of creation of the pivot.

If anybody see this mistake or think to another issue, please let me know.

(Sorry for my very bad english...:rolleyes: )|||Nevertheless I believe it's a problem of SQL..

Indeed, in my web.config, we use this connection string in our overall project and we haven't got any issue with this.

That's why I think there is a mistake in the script of creation of the pivot.Well if your class is creating invalid SQL then it really is a c# problem rather than a SQL one. As mentioned - the error is to do with your class. Without delving around in your class you are not going to get anywhere. Your code does pretty well nothing but retrieve a connection string, submit it to the class, call a class property and report an error in the class. If you say the connection string is wrong then there is nothing to do but step through your code.

HTH|||Thanks for the interest of my issue :)

As i have say, i test just to put this :

public partial class _Default : System.Web.UI.Page
{
private void Page_Load(object sender, System.EventArgs e)
{
//determine whether or not the browser supports OWC
if(Request.Browser.ActiveXControls)
{
Response.Write("<OBJECT id='pTable' style='Z-INDEX: 109; LEFT: 8px; WIDTH:502px; POSITION: absolute; TOP: 8px; HEIGHT: 217px' height='217' width='502'classid='clsid:0002E55A-0000-0000-C000-000000000046'VIEWASTEXT></OBJECT>");
//cause the object to load data on the client
Response.Write(@."<script>document.all.pTable.ConnectionString ='" + ConfigurationManager.ConnectionStrings["TimeTrackingDB"] + "'</script>");
Response.Write("<script>document.all.pTable.ResourceID = 'RESOURCE'</script>");

}

}
}

And i Have the error connection that i've mentionned :

http://img411.imageshack.us/my.php?image=owcscreenvl3.jpg

According to me, the issue is there

Response.Write(@."<script>document.all.pTable.ConnectionString ='" + ConfigurationManager.ConnectionStrings["TimeTrackingDB"] + "'</script>");

But I'm not able to see it. If someone see a BIG or a small :p mistake, please let me know.|||So, i've several answer in other forum. It really seem an SQL issue.
But nobody know how to fix it.
Maybe someone knows here :)

Response.Write(@."<script>document.all.pTable.ConnectionString ='Provider=MSDASQL.1;Persist Security Info=True;Extended Properties=\'DSN=MSAccess Database;DBQ=C:\Program Files\MicrosoftOffice\OFFICE11\SAMPLES\Northwind.m db;\';Initial Catalog=C:\ProgramFiles\Microsoft Office\OFFICE11\SAMPLES\Northwind'</script>");

This is the code I ve find on Internet with a connection to access file.

I want to adapt it with my Microsoft sqlServer 2000 and visual Studio

Database Name : TimeTracking
Pass : USER_TTT
login : USER_TTT
Provider : ??
Data Source = PORT06139\DEV_2000;
Initial Catalog=TimeTrackingDB
Persist Security Info=True

Does anybody can make the sql request according to the previous information?

Thanks you very much in advance. :rolleyes:

No comments:

Post a Comment