DiigIT | IT Community
No Profile Image
Welcome Guest
New User? Register | Login
SQL
IT Tags
DiigIT » SQL » qna

Error Uploading Excel to Database form Vb.net

By: rekha singh | 10 May 2010 5:49 pm

Hi

 
I am uploading the Excel sheet to Database through Vb.net .. and I have Written Stored Procedure in SQL Server and i have written it with te help of this link
 
SET ANSI_NULLS ON
 
GO
 
SET QUOTED_IDENTIFIER ON
 
GO
 
CREATE PROCEDURE spx_ImportFromExcel 03
 
@SheetName varchar(20),
 
@FilePath varchar(100) ,
 
@HDR varchar(3),
 
@TableName varchar(50)
 
AS
 
BEGIN
 
DECLARE @SQL nvarchar(1000)
 
IF OBJECT_ID (@TableName, 'U') IS NOT NULL
 
SET @SQL = 'INSERT INTO ' + @TableName + ' SELECT * FROM
OPENDATASOURCE'
 
ELSE
 
SET @SQL = 'SELECT * INTO ' + @TableName + ' FROM OPENDATASOURCE'
 
SET @SQL = @SQL + '(''Microsoft. Jet.OLEDB. 4.0'',''Data Source='
 
SET @SQL = @SQL + @FilePath + ';Extended Properties=' '''Excel 8.0;HDR='
 
SET @SQL = @SQL + @HDR + ''''''')...[ '
 
SET @SQL = @SQL + @SheetName + ']'
 
EXEC sp_executesql @SQL
 
END
 
GO
 
and My excel sheet has 45000 Rows where it has to import to the Db Table and It is giving error as follows may i know what might be wrong in the code or do i need to do some thing????
 
*Cannot initialize the data source object of OLE DB provider
"Microsoft.Jet. OLEDB.4.0" for linked server "(null)". OLE DB provider "Microsoft.Jet. OLEDB.4.0" for linked server "(null)"
returned message "System resource exceeded.".
*
Please give me solution what should be done?????
 
-- 
Thanks & Regards
 

Comments

Have a look at this link:
 
Covers the subject and options open to you far better than I could.
 
Your error in this specific case is you have not run the
sp_addLinkedServer (http://msdn. microsoft. com/en-us/ library/ms190479 .aspx ) proc to link the workbook. But before you do that take a look at the first link above as there are some other options you should consider for
solving the problem of getting the data in Excel into SQL Server.

 

By: rekha singh | 10 May 2010

Leave a comment

Enter the text in the image
img
Can't read?
Type the characters you see in the picture below.


Close Move