How to Import Records from Excel to SQL Server Database using Store Procedure in ASP.NET C#

preview_player
Показать описание
Here I have explain how to import records from excel file to SQL server database using stored procedure in ASP.NET C#. Excel data programmatically imported to SQL server database.

Following is solution of error that may occurred while importing data into SQL server database using Stored procedure

---------Error:--------------------

Error; The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine:-----------------

;-----------------SQL Server blocked access to STATEMENT 'OpenRowset/OpenDatasource' of component 'Ad Hoc Distributed Queries' because this component is turned off as part of the security configuration for this server. A system administrator can enable the use of 'Ad Hoc Distributed Queries' by using sp_configure. For more information about enabling 'Ad Hoc Distributed Queries', search for 'Ad Hoc Distributed Queries' in SQL Server Books Online.:-------------

Solution:----
EXEC sp_configure 'show advanced options', 1
RECONFIGURE
GO
EXEC sp_configure 'ad hoc distributed queries', 1
RECONFIGURE
GO

:------The OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "(null)" reported an error. Access denied. Cannot obtain the required interface ("IID_IDBCreateCommand") from OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "(null)":------------

Solutions : EXEC master.[sys].[sp_MSset_oledb_prop] N'Microsoft.ACE.OLEDB.12.0', N'AllowInProcess', 1

☕ Buy me a Coffee (Channel Support through Donation)

🌀 Related Videos

Subscribe to this channel

🎬 All Playlist

🌟 About this Channel
Csharp Space provide simple and step to step video tutorials of different programming languages like ASP.NET, ASP.NET Core, C#, ASP.NET MVC,
Angular JS, JavaScript, jQuery, SQL ,Crystal Report.
This channel also provide How to and problem solving topics of the programming languages.

🔗 Social Media Links

Thank You!!
I am feeling really humbled right now…there are 7000 incredible people (like you) who have subscribed to my YouTube channel! Wow!!! Thank you so much to those of you who have checked out my YouTube channel (CsharpSpace) and subscribed.

Please help me to reach 10000 subscribers milestone.
Рекомендации по теме
Комментарии
Автор

I don't see how this would be a practical solution in the real world. This would only work on your localhost personal development machine. The stored proc is attempting to open and read a file using a filepath, which would be on a webserver in a real world scenario. The database server and webserver would not be on the same machine. Even if you specified the server name in the filepath, you would still require firewall permissions and access rights from admin to read that file on the webserver, and they probably would not give you that. If I am misunderstanding what you are attempting to do, please correct me.

tookay
Автор

Same code is incorporated and showing error msg like incorrect syntax near*

naveenv
Автор

Hi I want use for web Api so I can use same code in video ?

Sameyo_Rei