Archive for the 'Windows Programming' Category

Sep 18 2009

Database Programming in VB.Net

Published by admin under Windows Programming

by Aurelie A. Peralta

Using ODBC, OLEDB, or SQLClient namespaces, VB.Net applications can easily connect and manipulate widely known databases like Microsoft Database File (*.mdf), Access Database File (*.mdb), and even MYSQL database. It is just a matter of placing the right connection strings for each type of db provider but the principles of incorporating SQL commands in the codes are basically the same. I have demonstrated this in my Elective 1 class and you can download the actual project using the link below:

http://www.psvphil.com/WindowsApplication7.rar

Extract the files using Winrar. Try to run the said application in your Visual Studio 2005 Express Edition and examine the codes.

No responses yet

Sep 25 2008

ADO.Net, Database connections and VB.Net database programming for Elective 1 students

Published by admin under Windows Programming

by Aurelie A. Peralta 

Overview of ADO.NET

ADO.NET provides consistent access to data sources such as Microsoft SQL Server, as well as data sources exposed through OLE DB and XML. Data-sharing consumer applications can use ADO.NET to connect to these data sources and retrieve, manipulate, and update data.

ADO.NET cleanly factors data access from data manipulation into discrete components that can be used separately or in tandem. ADO.NET includes .NET Framework data providers for connecting to a database, executing commands, and retrieving results. Those results are either processed directly, or placed in an ADO.NET DataSet object in order to be exposed to the user in an ad-hoc manner, combined with data from multiple sources, or remoted between tiers. The ADO.NET DataSet object can also be used independently of a .NET Framework data provider to manage data local to the application or sourced from XML.

The ADO.NET classes are found in System.Data.dll, and are integrated with the XML classes found in System.Xml.dll. When compiling code that uses the System.Data namespace, reference both System.Data.dll and System.Xml.dll. (http://msdn.microsoft.com/en-us/library/h43ks021(VS.71).aspx)

Here are some connection strings for the following providers:

1. System.Data.ODBC

For Microsoft Access Database:

Dim dbconn As New Odbc.OdbcConnection(”Driver={Microsoft Access Driver (*.mdb)};DBQ=” & Application.StartupPath & “\odbcdemodb.mdb”)

For MySQL Database:

Dim dbconn As New OdbcConnection(”DRIVER={MySQL ODBC 3.51 Driver};SERVER=localhost; DATABASE=alternacaredb;USER=root;PASSWORD=; OPTION=3;”)

Note: Install first the mysql-connector-odbc-3.51.22-win32.msi dll add-ons.

2. System.Data.OLEDB

For Microsoft Access Database:

Dim dbconn As New OleDb.OleDbConnection(”Provider=Microsoft.Jet.OLEDB.4.0;Data Source=” & Application.StartupPath & “\odbcdemodb.mdb”)

3. System.Data.SQLClient

For MS SQL Server Database:

Dim dbconn As New SqlClient.SqlConnection(”Data Source=MISBRAIN\SQLEXPRESS;Initial Catalog=registrardb;Integrated Security=True”)

For a sample File Maintenance Module created using VB.Net, download this file:

filemaintenance.rar

2 responses so far

Apr 19 2008

Let us talk about VB.NET as a first class programming language

Published by admin under Windows Programming

By Aurelie A. Peralta

This summer 2008, I have a class for the subject Elective 1 which is about object-oriented programming. With all the available true object-oriented language out there like java and C++, I chose VB.NET to be the programming language for this subject. Unlike in its previous version VB6, Visual Basic is not yet considered as a true OOP language that time because it still lacks some elements of true OOP language like java and C++ but now with VB.NET, Visual Basic programmers can also do what C++ programmers can do.

The syntax of Visual Basic is simple and easy to understand. The classes from the dotnetframework which are arranged in well-organized namespaces also makes rapid application development in VB.NET so easy to achieve.

I started our first meeting discussing some basics of programming going back to variables, data types, expressions, control of logic flow, procedures and functions, and variable scope and lifetime which of course covers the use of formless classes or modules.

After refreshing the minds of my students with these programming basics, my lecture was followed by actual demonstrations and this time Visual Basic 2005 express is our IDE. On my next post, I will be showing the actual codes of my demos.

No responses yet