Import csv file to access database using visual basic - vb.net

I'm very new to visual studio and visual basic.
I already studied the basics of visual basic so I tried stepping up a little and play with database in visual basic. I'm using visual studio 2010.
I first made an access database. I followed the instructions that I searched on the net on how to connect it to your visual basic program. Data>Show Data Source>Add Data Source> ...
But when I search on how to do it, I became really confuse because of these things:
Is vba and vb the same?
all the tutorials are for access but why do they still need to have a stringconnection when they already connect it using what I did?
they are searching for .mdb but the extension of my access database is .accdb?
they have an sql query for inserting the datas from the csv file but the pc that will be using the program don't have sql installed but mysql. Will it still work?
I'm still noob in these things so please if anyone can shed some light in these questions, thank you very much. >.<

VBA and VB 6.0 are almost the same. Main difference is that VBA is intended to be host in application like Excel, Word ....
BUT language you probably use with VS 2010 is VB.NET and that is something different. VB.NET is object oriented language which target .NET Runtime and Framewor. See Difference between Visual Basic 6.0 and VBA
Connection string is a string that specifies information about a data source and the means of connecting to it.
In .NET this describe (or can) path or location, provider, credentials and other informations. See MSDN Connection string in .NET
If I'm correct MDB is older format and ACCDB is format used by Microsoft Office Access 2007 and newer. Here is post how to connect to access db file: SQL connection string for microsoft access 2010 .accdb
But do you realy need to use acess database? There are better alternatives.
There is no need of real database engine for your scenario. You wanna to use standalone file as a datasource, dataprovider will be responsible for interaction with datasource. E.g. OleDB provider

Related

SQL Server compact

I'm trying to get data from api and insert them into a SQL Server .sdf database file, but I'm not sure how to do it especially that I'm using Windows forms on Visual Studio 2010
Can someone help me ?
This is a very broad question, however, at a very high level, you will need to open up a connection to the SQL Server Database and use a data access technology such as ADO.NET or EntityFramework to work with the objects in the database.
See the answer in this thread for an example of working with ADO.NET.

How can I run vb.NET code from within Access 2010 (vba)? Accessing win 32 OpenSqlFilestream API through vb.NET, within Access 2010

thanks for your time good people!
I am adapting an Access 2010 client to work with a new SQL Express Server 2008 back end. The back end is up and running. No problems there. Filestream is configured and working fine.
My problem relates to acessing the filestream BLOB data I've stored in the SQL Express Server 2008 instance from my client. Specifically accessing the data through the win 32 OpenSqlFilestream API as detailed here: https://msdn.microsoft.com/en-us/library/cc645940.aspx
I know I cannot access this API within VBA. I have to write all the relevant code in a different language. Therefore I plan to write a mini-program in VB.NET which will consist of a pop up form that allows users to add, edit, delete etc the files stored through filestream.
I want to open this mini VB.NET program from within Access 2010 as a pop up form.
How do i do this? I have never written or compiled a program in vb.NET, furthermore I don't know how I can then call this program from within my VBA code in the Access 2010 client.
Please help.
Thanks,
Patrick Quigley

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

Connectivity between Vb.net and Ms-access

I wanted to know, could we establish database connectivity using VB.Net 2005 and MS-access 2007?
If yes then, how could we do that? I am looking for the whole procedure.
If no then, why can't we do that?
Thank you!
It depends on what you're trying to do. VSTO fully supports VB.Net as well as Access 2007. You can also use the Office Data Access install to enable direct access from ADO.NET to .mdb and .accdb files (as well as Excel spreadsheets).

Save Data from WinForms Controls to a SQL Server Database

So I am just getting started with this. New to .NET, SQL Server, C#, VB.NET, etc and the closest thing I have to related to this is some experience with MS Access and the VBA that relates to that and MS Office automation.
So I do have Visual VB.NET 2008 Express installed, SQL Server 2005 express installed, and I do know how to start a brand new project in VB.NET, and then add the database to the solution explorer, modify the tables/fields, etc. I know how to create a WinForm, add some controls (and name them and whatnot).....
So in MS Access I know how to use VB in the Code-Behind-Form to use the form in an unbound manner, and insert data into the tables via Visual Basic with SQL statements. I am looking to be able to begin the same sort of thing here, because I guess I have to start somewhere?
This may be a bit overwhelming, but I'd start with the videos here: http://windowsclient.net/learn/
and in particular, look for the data videos at the bottom of this page.
http://windowsclient.net/learn/videos.aspx