|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Excel ADO questionI use Excel file as a data source for my Web Service.
I want to know a few things. 1. When reading from the Excel file, does it remain locked for the time of reading the data? Must I implement some logic, to check if the file is locked? 2. May I use SQL statements to Insert, Update and Delete information in the Excel file? 3. Because I am using and OleDB connection to fill a DataSet, can I use the DataAdapter to update the data to the Excel file, like the way when a SQL Server connection is used? Thanks 1) the file is locked for the time you have the connection open or the time
it takes to fill a table if you let an adapter open/close it for you 2) Yes 3) Yes -- Show quoteW.G. Ryan MVP (Windows Embedded) TiBA Solutions www.tibasolutions.com | www.devbuzz.com | www.knowdotnet.com "Nikolay Petrov" <johntup2_nospam_@mail.bg> wrote in message news:upxLFQCNFHA.3356@TK2MSFTNGP12.phx.gbl... > I use Excel file as a data source for my Web Service. > > I want to know a few things. > > 1. When reading from the Excel file, does it remain locked for the time of > reading the data? Must I implement some logic, to check if the file is > locked? > 2. May I use SQL statements to Insert, Update and Delete information in the > Excel file? > 3. Because I am using and OleDB connection to fill a DataSet, can I use the > DataAdapter to update the data to the Excel file, like the way when a SQL > Server connection is used? > > Thanks > > > Thanks.
Should I then try to check, if the file is locked first, or the OLEDB connection check the file status by itself, and do some retries if it is locked? Show quote "W.G. Ryan eMVP" <WilliamRyan@NoSpam.gmail.com> wrote in message news:%23kezsWCNFHA.1732@TK2MSFTNGP14.phx.gbl... > 1) the file is locked for the time you have the connection open or the > time > it takes to fill a table if you let an adapter open/close it for you > 2) Yes > 3) Yes > > -- > W.G. Ryan MVP (Windows Embedded) > > TiBA Solutions > www.tibasolutions.com | www.devbuzz.com | www.knowdotnet.com > "Nikolay Petrov" <johntup2_nospam_@mail.bg> wrote in message > news:upxLFQCNFHA.3356@TK2MSFTNGP12.phx.gbl... >> I use Excel file as a data source for my Web Service. >> >> I want to know a few things. >> >> 1. When reading from the Excel file, does it remain locked for the time >> of >> reading the data? Must I implement some logic, to check if the file is >> locked? >> 2. May I use SQL statements to Insert, Update and Delete information in > the >> Excel file? >> 3. Because I am using and OleDB connection to fill a DataSet, can I use > the >> DataAdapter to update the data to the Excel file, like the way when a SQL >> Server connection is used? >> >> Thanks >> >> >> > > > No just open and close it in every webservice method. (Assuming that you are > Should I then try to check, if the file is locked first, or the OLEDB > connection check the file status by itself, and do some retries if it is > locked? > > not working with multiprocessors or load balanced, however in that case looks an excel sheet me very much underpowered). Cor Thanks Cor
Yes Excel is underpowered, but for storing a 10 row of data in easy for users to edit format is just enough. Show quote "Cor Ligthert" <notmyfirstn***@planet.nl> wrote in message news:eiH3daDNFHA.3760@TK2MSFTNGP12.phx.gbl... > > >> Should I then try to check, if the file is locked first, or the OLEDB >> connection check the file status by itself, and do some retries if it is >> locked? >> >> > No just open and close it in every webservice method. (Assuming that you > are not working with multiprocessors or load balanced, however in that > case looks an excel sheet me very much underpowered). > > Cor > If all you are going to do is store 10 rows of data, why not just use an XML
file instead of all that Excel overhead. Show quote "Nikolay Petrov" <johntup2_nospam_@mail.bg> wrote in message news:uRuASmENFHA.1308@TK2MSFTNGP15.phx.gbl... > Thanks Cor > > Yes Excel is underpowered, but for storing a 10 row of data in easy for > users to edit format is just enough. > > > "Cor Ligthert" <notmyfirstn***@planet.nl> wrote in message > news:eiH3daDNFHA.3760@TK2MSFTNGP12.phx.gbl... > > > > >> Should I then try to check, if the file is locked first, or the OLEDB > >> connection check the file status by itself, and do some retries if it is > >> locked? > >> > >> > > No just open and close it in every webservice method. (Assuming that you > > are not working with multiprocessors or load balanced, however in that > > case looks an excel sheet me very much underpowered). > > > > Cor > > > > User,
In my opinon is a xml file is a very dangerous datafile to use in this case. It has everytime to be written and rewritten and with one write error all the data is gone when you don't create very good and file IO expensive routines arround it to prevent that. I would use an access database instead of an Excel sheet when it has to be a kind of database in a file. However, just my thought Cor I am sure that any kind of Database is preferable then Excel.
But the generated file must be opened easily by users, and the should do some calculation on data in it. They do this in Excel, so I think that this is the most appropriate way in this scenario. Show quote "Cor Ligthert" <notmyfirstn***@planet.nl> wrote in message news:OTdhgWINFHA.580@TK2MSFTNGP15.phx.gbl... > User, > > In my opinon is a xml file is a very dangerous datafile to use in this > case. It has everytime to be written and rewritten and with one write > error all the data is gone when you don't create very good and file IO > expensive routines arround it to prevent that. > > I would use an access database instead of an Excel sheet when it has to be > a kind of database in a file. > > However, just my thought > > Cor > On Tue, 29 Mar 2005 08:56:12 +0300, "Nikolay Petrov" <johntup2_nospam_@mail.bg> wrote: ¤ I use Excel file as a data source for my Web Service.¤ ¤ I want to know a few things. ¤ ¤ 1. When reading from the Excel file, does it remain locked for the time of ¤ reading the data? Must I implement some logic, to check if the file is ¤ locked? Are you experiencing read locks? Although Microsoft doesn't recommend concurrent access to an Excel file, AFAIK it can be configured for shared mode using Microsoft Excel. ¤ 2. May I use SQL statements to Insert, Update and Delete information in the ¤ Excel file? Yes, yes and no. ¤ 3. Because I am using and OleDB connection to fill a DataSet, can I use the ¤ DataAdapter to update the data to the Excel file, like the way when a SQL ¤ Server connection is used? Yes. Paul ~~~~ Microsoft MVP (Visual Basic) |
|||||||||||||||||||||||