I would like to open an OleDbConnection to an Excel file that's in memory as a FileStream. Does anyone know if this is possible and how to accomplish it?
我想打开一个OleDbConnection到一个Excel文件,该文件作为文件流存储在内存中。有人知道这是否可能,以及如何实现它吗?
Big picture I would like to pass the file bytes into a .NET CLR Stored Procedure and extract the data. Perhaps there's a better way to do this that I've not considered.
总的来说,我希望将文件字节传递到。net CLR存储过程中并提取数据。也许有一种更好的方法,我还没有考虑过。
Thanks in advance.
提前谢谢。
3 个解决方案
#1
0
The VSTO solution JP offers is definitely viable. However, if you really want to use OleDb and some SQL, take a look at this artcile: it's a MS knowledge base article that describes how to import data from excel into SQLSever using OleDb.
VSTO解决方案JP提供的是绝对可行的。但是,如果您真的想使用OleDb和一些SQL,请看看这个artcile:它是一个MS知识库文章,描述如何使用OleDb从excel导入数据。
#2
1
You can use SpreadsheetGear to open a file from a byte array in memory or from any stream with SpreadsheetGear.Factory.GetWorkbookSet().Workbooks.OpenFromMemory(byte[]) / OpenFromStream(System.IO.Stream).
可以使用SpreadsheetGear从内存中的字节数组或任何带有spreadsheetgeary . factory . getworkbookset (). workbooks.openfrommemory (byte[]) / OpenFromStream(System.IO.Stream)的流中打开文件。
Disclaimer: I own SpreadsheetGear LLC
免责声明:我拥有SpreadsheetGear LLC公司
#3
0
You can extract the data using VSTO. It has an object model for Excel. Then pass what you want to the proc. I think that would be better than trying to have the CLR stored proc decipher an Excel file stream.
您可以使用VSTO提取数据。它有一个Excel的对象模型。然后将您想要的内容传递给proc。我认为这比尝试让CLR存储的proc解码一个Excel文件流要好。
#1
0
The VSTO solution JP offers is definitely viable. However, if you really want to use OleDb and some SQL, take a look at this artcile: it's a MS knowledge base article that describes how to import data from excel into SQLSever using OleDb.
VSTO解决方案JP提供的是绝对可行的。但是,如果您真的想使用OleDb和一些SQL,请看看这个artcile:它是一个MS知识库文章,描述如何使用OleDb从excel导入数据。
#2
1
You can use SpreadsheetGear to open a file from a byte array in memory or from any stream with SpreadsheetGear.Factory.GetWorkbookSet().Workbooks.OpenFromMemory(byte[]) / OpenFromStream(System.IO.Stream).
可以使用SpreadsheetGear从内存中的字节数组或任何带有spreadsheetgeary . factory . getworkbookset (). workbooks.openfrommemory (byte[]) / OpenFromStream(System.IO.Stream)的流中打开文件。
Disclaimer: I own SpreadsheetGear LLC
免责声明:我拥有SpreadsheetGear LLC公司
#3
0
You can extract the data using VSTO. It has an object model for Excel. Then pass what you want to the proc. I think that would be better than trying to have the CLR stored proc decipher an Excel file stream.
您可以使用VSTO提取数据。它有一个Excel的对象模型。然后将您想要的内容传递给proc。我认为这比尝试让CLR存储的proc解码一个Excel文件流要好。