Saving an Access table as dBASE_IV file (.dbf) in VB.NET - vb.net

I am making a small application that will read .csv files into a newly generated access table (generated with vb.net), I am filling this database with sql and now I would like to output that table as a .dbf file!
I can't find any info on this subject.
I know some of you will tell me to just make the script in vba in access, but there are some functions that require me to use vb.net and the client wants a single .exe file.

There is a forum post here that includes some VB.NET sample code to create a .dbf file and write some data into it. The code uses the Visual FoxPro OLEDB driver (VFPOLEDB) which is no longer distributed with Windows by default, but can be downloaded here.

Related

VB.net 2008 monitoring mdb

Currently I am writing a code using VB.net 2008 to display changes happen in an access 2002 database mdb file. The mdb is using by another program for input and i have no access to that program source code.Currently I am using timer function in my program to get latest data from mdb file. Is there any other solution can use to monitoring the database for any changes on table data.
Thanks for any tips and help.

How do I upload an Excel sheet to a SQL table in a Lightswitch web client?

I have a lightswitch project in visual studio 2013, using vb.net. I would like the user to be able to click a button and have lightswitch find an excel file, and upload that file to a sql table according to a pre-determined column mapping.
My preference was to use the Office Integration extension for visual studio, which I got working with VS 2013 by downloading it from this link: http://www.ge.tt/71iuRQv/v/0
However, the documentation and examples for office integration seem to be very heavy on getting an excel spreadsheet into a display in the lightswitch web client, rather than into the sql data table, which is where I need it. Here are the examples I've been following:
http://blogs.msdn.com/b/bethmassi/archive/2012/07/18/new-and-improved-office-integration-pack-extension-for-lightswitch.aspx
Alternatively, I have an existing stored procedure, and I can request that the server call this stored proc by sending a web API extension from the client to the server. I have this working already for other stored procs, according to examples from Beth Masi and Paul van Bladel. (Stackoverflow won't let me post the links...)
The undesirable part of this approach is that the stored proc is old, and messy.
I've searched and searched, but have yet to find anyone approach this problem for VS 2013 with lightswitch. Any useful advice?
I've used the method detailed by Matt Sampson to store word files and it works very well. Since it just stores the raw binary it should handle Excel files just as well.
If you're creating the table in LightSwitch, use the Binary Type. If you use SQL create scripts use varbinary(MAX).
You need to create a custom Silverlight dialog box to gain access to the OpenFileDialog object. Then open the file in as a FileStream.
Finally, you need to add a handler for the closed method of the control and then show the control to the user. Most likely done in a button. This needs to be done on the main dispatcher.
The code examples are in C# but I just used one of the many available translators out on the web and copy/pasted the VB.NET code.
Another option might be to consider shelling out to the DTSEXEC run-time to execute an SSIS package to perform the upload - especially if the target Excel spreadsheets have predefined layouts and content data types.
Even simpler, you might be able to use the SQL Server BULK INSERT command to get the job done - although that would require a SQL Client connection to your database.
HTH

SharePoint temporary location

I am working with SharePoint 2010. I need to get the data from excel file stored in sharepoint library. I have plans to accomplish this by using OLEDB connection. So I need to download the excel file from doc library and store it in a temporary location and then access this temp file to get data from it. Now my question is which is the best ans safe location to stored the downloaded file? So far I have used SharePoint's layouts directory, C:windows:TEMP and even Path.GetTempFileName(). But the result I get this is " ACCESS DENIED!". Any ideas in temporary location? Is there any other location which is safe?
Thanks
Check whether you are running the file saving code with Run with elevated privileges and the app pool account has write access to the provided path. It's not a good practice to store temp files inside 14 hive.
Why don't you use Excel Web services to read the excel file if your farm has excel services enabled.
Refer http://msdn.microsoft.com/en-us/library/ms500767%28v=office.14%29.aspx
Or else try to use third party libraries like EPPlus where you can open the excel file using a stream rather than from a physical file location.

How to edit a Word Document (.docx) stored in a SQL Server Table?

How to edit a Word Document (.docx) stored in a SQL Server Table?
Here is the tentative work flow:
Read BLOB from SQL Table through Ideablade
Write BLOB to disk as .docx
Open .docx using Word
User makes changes
Save .docx using Word
Read .docx into BLOB
Write BLOB back to SQL Table through Ideablade
All sample code is welcomed?
I am sure there are a lot of people doing this already.
Any other ideas on how to simplify this process?
I am using VB.NET, .NET 3.5 SP1, WinForm and SQL Server 2008.
Well, as to the how, here is how to read a blob and write a blob to SQL. Although frankly, unless you have very good reasons such as an existing backup system, you would probably be best served storing the file to the file system and the path and metadata in the database. Either way, abstract it in your BLL, so you can change your mind down the road.
Retrieving and updating the BLOB from the db shouldn't be a problem, you'll find lots of sample code to do that on the net.
A simple approach to your problem would be to create a "temp" or "working" directory somewhere and monitor it with System.IO.FileSystemWatcher (sample code). When the user wants to edit a file, fetch it from the db and store it the directory. Whenever the user saves the file, you'll get a notification from your FileSystemWatcher, so you can save it to the database. Don't forget to empty the directory from time to time.
The method I've seen for this that I think works best is to build this as an add-on for MS Word itself. Examples include the Save to Sharepoint, Save to Moodle, and other similar add-ins.

I need to generate a file from binary information in sql

I am writing a windows desktop application in visual basic and I need it to connect to a SQL database, take a rows unique id, and using that number generate a file from the binary data that is stored in the SQL database and save it to a file directory.
The part that is hanging me up is the creating the file from the binary SQL data.
Any help would be appreciated. Thanks.
Here is an example which shows how to store/generate images from sql server database: How To Read and Write BLOB Data by Using ADO.NET with Visual C# .NET You can use it for any type of file.
VB6 or .net? You have both tags but the text says only visual basic.
Possible solution:
http://www.vbdotnetheaven.com/UploadFile/mahesh/BLOBinAdoDotNet04232005065613AM/BLOBinAdoDotNet.aspx