Showing posts with label follows. Show all posts
Showing posts with label follows. Show all posts

Friday, March 30, 2012

Problem with SQLXML BulkLoad from .NET Application

I am using BulkLoad from .NET application as follows

SQLXMLBULKLOADLib.SQLXMLBulkLoad4Class obj = new SQLXMLBULKLOADLib.SQLXMLBulkLoad4Class();

obj.ConnectionString = "Provider=SQLOLEDB;Server=serverName;Database=dbName;Integrated Security=SSPI";

obj.ErrorLogFile = Application.StartupPath + @."\Error.log";

obj.IgnoreDuplicateKeys = true;

try

{

obj.Execute(Application.StartupPath + @."\Schema1.xsd", Application.StartupPath + @."\Data1.xml");

obj.Execute(Application.StartupPath + @."\Schema2.xsd", Application.StartupPath + @."\Data2.xml");

}

catch (Exception ex)

{

throw ex;

}

I get following error when I run my application:

InvalidCastException was unhandled by user code.

Unable to cast COM object of type 'SQLXMLBULKLOADLib.SQLXMLBulkLoad4Class' to interface type 'SQLXMLBULKLOADLib.ISQLXMLBulkLoad4'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{88465BA7-AEEE-49A1-9499-4416287A0160}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).

When I run the same code in a Console application it works alright. In my application the code is executed on a Background thread, could that be cause of exception? Please help.

Thanks

From SQL Server Books Online :

Using SQLXML Bulk Load in the .NET Environment

The reference to the Bulk Load component (xblkld4.dll) can also be added using the tlbimp.exe tool, which is available as part of .NET framework. This tool creates a managed wrapper for the native DLL (xblkld4.dll), which can then be used in any .NET project. For example:

c:\>tlbimp xblkld4.dll

This creates the managed wrapper DLL (SQLXMLBULKLOADLib.dll) that you can use in the .NET Framework project. In the .NET Framework, you add project reference to the newly created DLL.

Please follow the link for more info :

http://msdn2.microsoft.com/en-us/library/ms171878.aspx.

This will solve your issue.

Thanks

Naras.

|||

I think you should use

[STAThread]

staticvoid Main(string[] args)

{

//your code

}

|||I am having the same problem, however, running tlbimp does not fix it. I have to run tlbimp on the full path to the DLL because it can't find it unless I specify it. I get the same error. Please help!

Problem with SQLXML BulkLoad from .NET Application

I am using BulkLoad from .NET application as follows

SQLXMLBULKLOADLib.SQLXMLBulkLoad4Class obj = new SQLXMLBULKLOADLib.SQLXMLBulkLoad4Class();

obj.ConnectionString = "Provider=SQLOLEDB;Server=serverName;Database=dbName;Integrated Security=SSPI";

obj.ErrorLogFile = Application.StartupPath + @."\Error.log";

obj.IgnoreDuplicateKeys = true;

try

{

obj.Execute(Application.StartupPath + @."\Schema1.xsd", Application.StartupPath + @."\Data1.xml");

obj.Execute(Application.StartupPath + @."\Schema2.xsd", Application.StartupPath + @."\Data2.xml");

}

catch (Exception ex)

{

throw ex;

}

I get following error when I run my application:

InvalidCastException was unhandled by user code.

Unable to cast COM object of type 'SQLXMLBULKLOADLib.SQLXMLBulkLoad4Class' to interface type 'SQLXMLBULKLOADLib.ISQLXMLBulkLoad4'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{88465BA7-AEEE-49A1-9499-4416287A0160}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).

When I run the same code in a Console application it works alright. In my application the code is executed on a Background thread, could that be cause of exception? Please help.

Thanks

From SQL Server Books Online :

Using SQLXML Bulk Load in the .NET Environment

The reference to the Bulk Load component (xblkld4.dll) can also be added using the tlbimp.exe tool, which is available as part of .NET framework. This tool creates a managed wrapper for the native DLL (xblkld4.dll), which can then be used in any .NET project. For example:

c:\>tlbimp xblkld4.dll

This creates the managed wrapper DLL (SQLXMLBULKLOADLib.dll) that you can use in the .NET Framework project. In the .NET Framework, you add project reference to the newly created DLL.

Please follow the link for more info :

http://msdn2.microsoft.com/en-us/library/ms171878.aspx.

This will solve your issue.

Thanks

Naras.

|||

I think you should use

[STAThread]

static void Main(string[] args)

{

//your code

}

|||I am having the same problem, however, running tlbimp does not fix it. I have to run tlbimp on the full path to the DLL because it can't find it unless I specify it. I get the same error. Please help!

Problem with SQLXML BulkLoad from .NET Application

I am using BulkLoad from .NET application as follows

SQLXMLBULKLOADLib.SQLXMLBulkLoad4Class obj = new SQLXMLBULKLOADLib.SQLXMLBulkLoad4Class();

obj.ConnectionString = "Provider=SQLOLEDB;Server=serverName;Database=dbName;Integrated Security=SSPI";

obj.ErrorLogFile = Application.StartupPath + @."\Error.log";

obj.IgnoreDuplicateKeys = true;

try

{

obj.Execute(Application.StartupPath + @."\Schema1.xsd", Application.StartupPath + @."\Data1.xml");

obj.Execute(Application.StartupPath + @."\Schema2.xsd", Application.StartupPath + @."\Data2.xml");

}

catch (Exception ex)

{

throw ex;

}

I get following error when I run my application:

InvalidCastException was unhandled by user code.

Unable to cast COM object of type 'SQLXMLBULKLOADLib.SQLXMLBulkLoad4Class' to interface type 'SQLXMLBULKLOADLib.ISQLXMLBulkLoad4'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{88465BA7-AEEE-49A1-9499-4416287A0160}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).

When I run the same code in a Console application it works alright. In my application the code is executed on a Background thread, could that be cause of exception? Please help.

Thanks

From SQL Server Books Online :

Using SQLXML Bulk Load in the .NET Environment

The reference to the Bulk Load component (xblkld4.dll) can also be added using the tlbimp.exe tool, which is available as part of .NET framework. This tool creates a managed wrapper for the native DLL (xblkld4.dll), which can then be used in any .NET project. For example:

c:\>tlbimp xblkld4.dll

This creates the managed wrapper DLL (SQLXMLBULKLOADLib.dll) that you can use in the .NET Framework project. In the .NET Framework, you add project reference to the newly created DLL.

Please follow the link for more info :

http://msdn2.microsoft.com/en-us/library/ms171878.aspx.

This will solve your issue.

Thanks

Naras.

|||

I think you should use

[STAThread]

static void Main(string[] args)

{

//your code

}

|||I am having the same problem, however, running tlbimp does not fix it. I have to run tlbimp on the full path to the DLL because it can't find it unless I specify it. I get the same error. Please help!

Monday, March 12, 2012

Problem with Reusing ReportViewer Control

I am resusing the Report Viewer Control depending on a selection the user
makes.
I load the report definition as follows:
rvFBReport.LocalReport.LoadReportDefinition(sr)
where sr is a streamreader loading the rdl file.
Then I pass in the datasource via:
rvFBReport.LocalReport.DataSources.Add(rds)
where rds is a reportdatasource.
It works great until I try loading a different report using the same
reportviewer.
I have also tried using rvFleetInvoices.LocalReport.DataSources.Clear()
but to no effect. What happens is the report comes up but contains no data
even though there is. It is almost as if the report is not refreshing the
data when switching between different RDL's
Any help/thoughts would be appreciated.Here is another symptom that may narrow it down. If the other reports that I
select has fields with the same name then those fields show up. But any
fields that were not in the first loaded report do not show up. It is almost
as if the datasource is not refreshing the field list.
"Scott Eguires" wrote:
> I am resusing the Report Viewer Control depending on a selection the user
> makes.
> I load the report definition as follows:
> rvFBReport.LocalReport.LoadReportDefinition(sr)
> where sr is a streamreader loading the rdl file.
> Then I pass in the datasource via:
> rvFBReport.LocalReport.DataSources.Add(rds)
> where rds is a reportdatasource.
> It works great until I try loading a different report using the same
> reportviewer.
> I have also tried using rvFleetInvoices.LocalReport.DataSources.Clear()
> but to no effect. What happens is the report comes up but contains no data
> even though there is. It is almost as if the report is not refreshing the
> data when switching between different RDL's
> Any help/thoughts would be appreciated.|||Never Mind I solved it myself. You have to do a reset before making the
change. i.e.,
reportviewer1.reset
"Scott Eguires" wrote:
> I am resusing the Report Viewer Control depending on a selection the user
> makes.
> I load the report definition as follows:
> rvFBReport.LocalReport.LoadReportDefinition(sr)
> where sr is a streamreader loading the rdl file.
> Then I pass in the datasource via:
> rvFBReport.LocalReport.DataSources.Add(rds)
> where rds is a reportdatasource.
> It works great until I try loading a different report using the same
> reportviewer.
> I have also tried using rvFleetInvoices.LocalReport.DataSources.Clear()
> but to no effect. What happens is the report comes up but contains no data
> even though there is. It is almost as if the report is not refreshing the
> data when switching between different RDL's
> Any help/thoughts would be appreciated.

Friday, March 9, 2012

Problem with Reporting service toolbox!

Hi All!!!!

When I create new reporting service I have problem with toolbox as follows:

Please help me to solved problem. Thanks

Hi,

From the image you provided, it seems that the report items in toolbox is mixed up.

Since we don't know if you have any modification on the toolbox (especially for the control assembly), I just provide you some steps to diagnose the problem.

1. Try to right click on the report items in your toolbox, and choose "Reset ToolBox" button, to see if it can fix the issue.
2. Try to right click on the report items in your toolbox, and click on 'choose items' to open the "Choose Toolbox items" window, switch to the .NET Framework components tab, try to check if there are so many textboxes control with different edition.
3. Go to %SystemRoot%/Assembly/ folder, try to find if the textbox controls exists normally.(Is any other extra textbox controls?)
4. After those steps, if the problem still exists, try to re-install your Business Intelligence Projects components.


Thanks.

Saturday, February 25, 2012

Problem with picking the right algorithm

Hi

I'm using SQL Server 2005. The problem I have is as follows. I have several production lines and as with everything parts in the line tend to break. I have data from all the breaks that occurred in the last 2 years. What I want to do is predict the next break and the production line it's going to happen on. I would also like to go to a future date and check what possible breaks might occur on that date. I've run quite a few models but none of them helps me with future events. I think I might be using the wrong algorithm or I’m just not doing it right. If somebody can please suggest an algorithm and maybe help me with a web site that has a tutorial similar to my problem

Thanks
Elmo

This sounds like an interesting topic. Would you please provide us more information: like how are you current current data structured, what are you trying to predict, what algorithms have you tried, and why the results are not good enough, etc. It will also be helpful if you could provide a small sample of your data.

Thanks,

|||

Hi

Thanks for the reply. I've mailed an Excel spreadsheet with some data on it to yiminwu@.online.microsoft.com. The things I would like to predict as follows: Plant, Circuit, Start Date and End Date. I would also like to be able to go to a future date and see what possible breaks will happen on that day. The aim is to do preventative maintenance.

I’ve tried the following algorithms: Decision Trees & Neural Networks. The problem I have with these is that it predicts that if something breaks on say Circuit 1 it is in Plant B. This is quite obvious. Thing is I need a way to look at future dates. I also tried the Sequence Clustering algorithm to see if could predict the next break but it detected no sequence.

Elmo

|||

Thanks a lot for your information. You need to transform your data a little for data mining algorithms to do meaningful predictions on your problem. Instead of using the plain date, you may transform it into various ranges like this:

Date interval (from start date to end date) Date interval value for mining model

0-6 monthBrand New

6-12 month Used for a while

12-24 monthSort of Worn

>2YearsWorn

The above is just an example. You should decide the best mapping based on your domain knowledge. The structure of your training data will then look like the following:

PlantIDKey Long

CircuitIDKey Long

Device IntervalText Discrete Input

Break Boolean Discrete Predict

And your data will look like this:

PlantIDCircuitIDDevice IntervalBreak

11BrandNewNo

……

11WornYes

In the above, I assume that PlantID and CircuitID comprise the composite key of your product lines. You can then train Microsoft Decision Tree or Microsoft Neural Network to predict whether your product lines will break.

Moreover, you may also bring in more information that affects the status of your product lines, such as: humidity and temperature, etc. As a reminder, you want to identify the features that: 1) contributed the failure of your product lines; 2) were different on various breaks. This basically requires you to use your domain knowledge to identify the key factors of product line breaks.

BTW, if possible, please post your sample data directly in your post in the future.

Good luck,

|||

As Yimin says, this is not an algorithm selection issue, rather a data preparation issue. If you want to predict if a break will happen in the next day, for instance you need to create a variable that says "a break happened in this day" and variables describing the time period leading up to the break, e.g. the previous day, previous week, etc.

For example

Next Day Break (predict)
Today's Volume
7 day average volume
30 day average volume
days since last break
# of breaks in last month
# of breaks in last year
personnel info
product info

etc.

HTH

-Jamie

|||

Hi

Sorry for only replying now but I was not at work for the most of last week.

Thank you both for the replies I’m sure I’ll be able to sort it out now. If I can’t I know where to find you.

Thanks again

Elmo