Click here to Skip to main content
15,893,722 members

Cannot initialize the data source object of OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "(null)".

Afzal Shaikh asked:

Open original thread
getting below error while exporting query result to excel 2010

SQL
EXEC master.dbo.sp_MSset_oledb_prop N'Microsoft.Jet.OLEDB.4.0', N'AllowInProcess', 1  
  
GO   
  
EXEC master.dbo.sp_MSset_oledb_prop N'Microsoft.Jet.OLEDB.4.0', N'DynamicParameters',1  
  
GO  
  
sp_configure 'show advanced options', 1  
GO  
RECONFIGURE WITH OverRide  
GO  
sp_configure 'Ad Hoc Distributed Queries', 1  
GO  
RECONFIGURE WITH OverRide  


Insert into tbl_Purchase (Purchase,YarnID)
select SUM(YarnTransQuantity) as Purchase , YarnID --into #Purchases
from YarnTransaction where YarnTransTypeID=4
group by YarnID

Insert into tbl_Sale (Sale,YarnID)
select SUM(YarnTransQuantity) as Sale , YarnID --into #Sales
from YarnTransaction where deptToID=13
group by YarnID

INSERT INTO OPENROWSET ('Microsoft.Jet.OLEDB.4.0', 'Excel 8.0;DataBase=C:\Users\Murtaza\Desktop\YMSLatest\YMS 7-10-2012\Costing.xls;',
'SELECT * FROM [Costing$]')
Select Distinct Y.YarnCode,YarnCodeDesc,Sum(YarnTransQuantity) as MonthOpening,OpeningRate,
Convert(Decimal(10,2),OpeningRate*Sum(YarnTransQuantity)) as OpeningValue,
isnull(Purchase,0.00) as Purchase,PurchaseValue,SUM(isnull(yarnConsumption,0.00)) as Consumption,
Convert(decimal(18,2),(((OpeningRate*Sum(YarnTransQuantity))+PurchaseValue)/isnull((Sum(YarnTransQuantity)+Purchase),1)*SUM(isnull(yarnConsumption,1)))) as ConsumptionValue
,isnull(Sale,0.00) as Sale,SaleValue,isnull(SaleValue,0.00)-isnull(Sale,0.00)*((Convert(Decimal(10,2),OpeningRate*Sum(YarnTransQuantity))+isnull(PurchaseValue,0.00))/(Sum(YarnTransQuantity)+Purchase)) as ProfitOnSale,
(Sum(YarnTransQuantity)+isnull(Purchase,0.00))-(SUM(isnull(yarnConsumption,0.00)))-isnull(Sale,0.00) as KGClosing,
Convert(Decimal(10,2),OpeningRate*Sum(YarnTransQuantity))+isnull(PurchaseValue,0.00)-
Convert(decimal(18,2),(((OpeningRate*Sum(YarnTransQuantity))+PurchaseValue)/isnull((Sum(YarnTransQuantity)+Purchase),1)*SUM(isnull(yarnConsumption,1))))-
((OpeningRate*Sum(YarnTransQuantity))+isnull(PurchaseValue,0.00))/((Sum(YarnTransQuantity)+isnull(Purchase,0.00)))*(isnull(Sale,0.00)) as ClosingValue
from YarnTransaction YT
inner join Yarn Y on YT.YarnID=Y.YarnID
inner join YarnCode YC on Yc.YarnId=YT.YarnID
inner join tbl_OpeningRates ORa on ORa.YarnId=YT.YarnID
left join tbl_Purchase P on P.YarnId=YT.YarnID
left join CalculateConsumption CC on CC.YarnId=YT.YarnID
left join tbl_Sale S on S.YarnId=YT.YarnID
left join tbl_CostingValues CV on CV.YarnCode=Y.YarnCode
Group By Y.YarnCode,YarnCodeDesc,OpeningRate,Purchase,Sale,yt.ColorCodeID,PurchaseValue,SaleValue



Msg 7399, Level 16, State 1, Line 42
The OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "(null)" reported an error. The provider did not give any information about the error.
Msg 7303, Level 16, State 1, Line 42
Cannot initialize the data source object of OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "(null)".
Tags: SQL, SQL Server 2008

Plain Text
ASM
ASP
ASP.NET
BASIC
BAT
C#
C++
COBOL
CoffeeScript
CSS
Dart
dbase
F#
FORTRAN
HTML
Java
Javascript
Kotlin
Lua
MIDL
MSIL
ObjectiveC
Pascal
PERL
PHP
PowerShell
Python
Razor
Ruby
Scala
Shell
SLN
SQL
Swift
T4
Terminal
TypeScript
VB
VBScript
XML
YAML

Preview



When answering a question please:
  1. Read the question carefully.
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  3. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
  4. Don't tell someone to read the manual. Chances are they have and don't get it. Provide an answer or move on to the next question.
Let's work to help developers, not make them feel stupid.
Please note that all posts will be submitted under the http://www.codeproject.com/info/cpol10.aspx.



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900