Dec 06

Visual Basic .Net to Synchronize data from Remote Database Server

VB.Net Occasionally Connected Data (OCS) to synchronize data from remote database server. This downloads data from the server to the .sdf file. Next, make data changes in the server data grid, and then click the save button. Click Synchronize again to download your changes to the client. Get full source code here


Dec 05

Visual Basic .Net on How to Use Print Preview, Print Setup and Page Setup

How to use the print preview, call print setup and page setup in Visual Basic .Net. The PrintPreviewDialog is associated with the PrintDocument as the preview is rendered, the PrintPage event is triggered. This event is passed a graphics context where it “draws” the page. Get the complete project


Dec 04

One-to-Many or Master-Detail Data entry in Visual Basic .Net

Visual Basic .Net sample project on how to create a One-to-Many (Master-Detail) Data entry form using the Data Sources Window and the Windows Forms designer in Visual Studio. This project connect the database Order as the master or parent then retrieve the order details as the child. Get the source code here


 

Dec 03

How to Connect Database in Visual Basic .Net

Sample project on Visual Basic .Net in windows forms  on how connect to an existing database and how to define how data is retrieved and updated using the data sources window and the dataset designer in Visual Studio. Download Project


Dec 01

Read Data from Oracle Database using Visual Basic .Net 2010

Sample code on how to access or retrieve data from Oracle database using visual basic .net 2010. Please add to reference the ODP.NET DLL to your visual studio reference in order to gain access to your oracle database server. Download Code

 

 

 

 

 

Screenshot

'Visual Basic Source Code

Imports Oracle.DataAccess.Client ' Visual Basic ODP.NET Oracle managed provider

Public Class frmdepartment

Private Sub frmdepartment_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim oradb As String = "Data Source=(DESCRIPTION=(ADDRESS_LIST=" _
+ "(ADDRESS=(PROTOCOL=TCP)(HOST=ORASRVR)(PORT=1521)))" _
+ "(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=ORCL)));" _
+ "User Id=hr;Password=hr;"

Dim conn As New OracleConnection(oradb) ' Visual Basic
conn.Open()

Dim cmd As New OracleCommand
cmd.Connection = conn
cmd.CommandText = "select department_id, department_name, location_id from departments" ' VB
cmd.CommandType = CommandType.Text

Dim dr As OracleDataReader = cmd.ExecuteReader()
While dr.Read()
ListBox1.Items.Add("The " + dr.Item("department_name") + _
" department is in " + dr.Item("location_id").ToString())
End While

dr.Dispose()
cmd.Dispose()
conn.Dispose()
End Sub

End Class