Follow us on twitter

Thursday, July 24, 2014


The Post-UTME Screening Exercise for 2014/2015 admission into various degree programmes in the College of Agricultural Sciences, Environmental Sciences, Humanities, Natural Sciences and Social and Management Sciences  takes place on  Wednesday, 30th ,  Thursday, 31st  July and Friday, 1st August,  2014 at the following Centres by 9.00 am each day.
1    Joseph Ayo Babalola University Campus, Ikeji Arakeji
2    Lagos Office, No.50, Ikorodu Road, Fadeyi.
3   Abuja Office, Christ Apostolic Church, FCC, DCC Headquarters, Stadium/Games Village, Roundabout before VIO Office, Area 1, Abuja.
The following categories of candidates are expected to attend:
1    Candidates who made Joseph Ayo Babalola University their first or second choice University.
2    Candidates who intend to change their first or second choice University to Joseph Ayo Babalola University.
3    All potential candidates who still intend to apply for admission to Joseph Ayo Babalola University.
Admission form is available online and at the Screening Centres on the screening days indicated above on presentation of a bank draft of N5, 000.
Barr. Wale Aderibigbe

NYSC to place corps members on civil service salary scale

ABUJA— The National Youth Service Corps, NYSC, is working with the National Salaries and Wages Commission, NSWC, to place corps members on a public service salary scale. The Director-General of NYSC, Brig. Gen. Johnson Olawumi, who disclosed this in Abuja, noted that the move would stop frequent agitation for a review of corps members’ allowances. Olawumi said the series of attempts made by the scheme to secure adjustment in the allowances of corps members at the National Assembly did not yield the desired result. He maintained that the current N19,800 monthly allowances for corps members was inadequate in view of current economic realities in the country, noting that they were working closely with the wages commission to concretise the proposal. On the forthcoming governorhip election in Osun State, Olawumi assured that the scheme would not compromise as alleged by some politicians. He said allegations by politicians that the scheme had compromised its partnership with the electoral body were unfounded and should be taken as political tactics. Olawumi said: “We have some political parties also alleging that all my staff in Osun State have compromised and agitating that I should remove them. You are bound to see things like this in elections. “I want to state categorically that we do not just deploy these corps members for electoral duties, and as far as we are concerned, they are not the alpha and omega in elections; they are just playing a minute role. “It is important to let you know that we do not just push them out. We conduct sensitisation training for them and in the cause of that, give them manual. “We let them know that they are all adults and should be ready to face the conse-quences of whatever action they decide to take.” - See more at:

Monday, July 21, 2014

Connecting to a Database with Visual Studio Tools


Two great tools that go great together 

VB.Net and SQL Server are powerful, industry-standard development tools from Microsoft.  It’s sometimes surprising to realize that anyone can download and use these programs for free.

Getting them installed and working together took longer than I expected.  Google searches showed that many people were even questioning whether a VB Express program could could access a SQL Server Express database.  It can, but there’s a trick to it.

So if you’re trying to get started with your first VB+SQL program, here’s a small app to start you off.  I hope it saves you a couple hours!

First, download and install Visual Basic 2010 Express and Sql Server 2008 Express from 

SQL Server

Next, start Sql Server Management Studio, and log in.
 (Start à All Programs à Microsoft SQL Server 2008 à SQL Server 2008)

Create a new database by right-clicking Databases and selecting New Database

Name the new database MyTestDB and click OK.

Expand the Databases folder to find your new database:

Click New Query and run this script to create an empty table named tblTest:

CREATE TABLE [MyTestDB].[dbo].[tblTest] (
   [tstNum_PK] [int] IDENTITY(1,1) NOT NULL ,
   [tstData] [varchar] (100) NOT NULL

Visual Basic 
Now start Visual Basic and create a new Windows Form Application named DatabaseTest. 
(Start à All Programs à Microsoft Visual Studio 2010 Express à Visual Basic 2010)

On your VB Form, add two TextBoxes and two Buttons.  For simplicity, we’ll leave the their properties at their default settings and change them in the code.

à Here’s the trick: with Visual Basic 2010 Express, you have to connect directly to the database file.  You may be used to connecting to remote database servers – you can’t do that here.  When you created MyTestDB above, SQL Server created a file on your PC named MyTestDB.mdf.  Find it, and if the full path name is different from:

C:\Program Files\Microsoft SQL Server\MSSQL10_50.SQLEXPRESS\MSSQL\DATA\MyTestDB.mdf

Then you’ll need to change two lines in this sample code to match your location.

Add the code below to your program.  Now you’re ready to run.

Start the program and type something into the first text box.  Then click Add to DB. 
Unless you see an error message, a new record was just written to your database.

To read and display all the records in this table, click Show DB.
The ‘1’ at the beginning is the Primary Key for your record – a field you generally want to include, but would rarely display.

That’s it.  If you got all the way through, you now have a working (though bare-bones) program to begin developing your own applications.  Good luck!

Imports System.Data.SqlClient 
Public Class Form1

   'at program startup, set the control properties
   Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
      Button1.Text = "Add to DB"
      Button2.Text = "Show DB"
      TextBox2.Multiline = True
   End Sub 

   'write a record to the database table
   Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
      Dim sqCon As New SqlClient.SqlConnection("Server=.\SQLExpress;AttachDbFilename=C:\Program Files\Microsoft SQL Server\MSSQL10_50.SQLEXPRESS\MSSQL\DATA\MyTestDB.mdf;Database=MyTestDB; Trusted_Connection=Yes;")
      Dim sqCmd As New SqlClient.SqlCommand

      sqCmd.Connection = sqCon            'create the DB connection
      sqCmd.CommandText = "INSERT INTO [MyTestDB].[dbo].[tblTest] VALUES ('" & TextBox1.Text & "')"
      sqCon.Open()                        'open the connection
      sqCmd.ExecuteNonQuery()             'execute the SQL command
      sqCon.Close()                       'close the connection
   End Sub 

   'read and display all records from the database table
   Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
      Dim sqCon As New SqlClient.SqlConnection("Server=.\SQLExpress;AttachDbFilename=C:\Program Files\Microsoft SQL Server\MSSQL10_50.SQLEXPRESS\MSSQL\DATA\MyTestDB.mdf;Database=MyTestDB; Trusted_Connection=Yes;")
      Dim sqCmd As New SqlClient.SqlCommand
      Dim sdrRow As SqlClient.SqlDataReader

      'define the DB connection and search string
      sqCmd.Connection = sqCon
      sqCmd.CommandText = "SELECT * FROM tblTest"

      'open the DB connection
      sqCon.Open()                        'open the DB connection
      sdrRow = sqCmd.ExecuteReader()      'read the entire table

      'extract and display each field
      TextBox2.Text = ""                  'clear the text box
      Do While sdrRow.Read()
         TextBox2.Text = TextBox2.Text & sdrRow.GetValue(0) & vbTab     'get the primary key
         TextBox2.Text = TextBox2.Text & sdrRow.GetValue(1) & vbCrLf    'get the string

      'close up and return

   End Sub
End Class

Creating a Connection to a Database C#

Before we delve into the data-driven world of ADO.NET, let's first take a look at some tools available in the Visual Studio products. The following example shows you one way of connecting to a database without writing any code.

Creating a Connection to a Database

Open Visual C# Express and create a new Windows Forms Application. Name the project as DatabaseConnection. In Visual Studio, the Database Explorer is called Server Explorer. It is opened by default in Visual C# Express located in the left as a tab.
Database Connection 01
If you can't find the Database Explorer, go to View > Other Windows > Database Explorer to open it up. Click the Connect to Database icon in the Database/Server Explorer.
Database Connection 02
Clicking it shows up the Add Connection Window.
Database Connection 03
Be sure that the Data source uses Microsoft SQL Server Database File. If not, you can click the Change button and choose the appropriate data source. We also need to provide the file name of the database file that was created when we create our database. Click Browse to show up the open dialog. By default, the database files of SQL Server Express is located in C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data. Paste this path in the url bar of the Open dialog to immediately go to that directory. Find the University.mdf file and select it. Click Open.
If an error shows up tellng that file is used by another program. Open up the Services program by clicking Start and typing the word services in the search box. Find the SQL Server (SQLEXPRESS) service and right click on it. Choose Restart to restart the service.
Database Connection 04
After it is restarted, we can now go back to choosing the University.mdf file. After pressing open, click the Test Connection button in the Add Connection Window to test if our application can successfully connect to the database. If nothing is wrong, then a success message will show up.
Database Connection 05
Press OK to close the message. You can also choose the Authentication mode to be used. You can ues Windows Authentication or SQL Server Authentication. You must provide the username and password if you are to use SQL Server Authentication mode. Press OK to close the Add Connection Window and add the database file to the Database Explorer window.
Database Connection 06
The Database Explorer allows you to see the contents of a database. If you expand a database file such as the University.mdf, you can see parts of it such as its tables and stored procedures. Expanding the Tables node shows our Students table and expanding the table shows its columns.
Database Connection 07

Creating a DataSet

A DataSet can be considered as a mini database located in the computer's memory. It's main purpose is to obtain the data received from the database and store it in different tables just like how a database stores its records. The next step is to create a DataSet that will contain the contents the database that we have connected to. We will be using the Data Sources Window. If you can't see it, then go to Data > Show Data Sources. It will be located to the left of the IDE by default.
Database Connection 08
Click the Add New Data Source button to open up the Data Source Configuration Wizard.
Database Connection 09
Choose Database and click Next.
Database Connection 10
Choose Dataset then click Next.
Database Connection 11
In the combo box, be sure to select University.mdf that we have connected using the Database Explorer. Click Next.
Database Connection 12
You will then be prompted that the database file needs to be coppied to the project's directory. Clicking yes will copy it to the project's directory. You can confirm that the database has been coppied by looking at the Solution Explorer and finding University.mdf.
Database Connection 13
This window simply saves the connection string used to connect to the University database. Connection strings will be discussed in a later lesson. For now, you can leave the defaults and click Next.
Database Connection 14
Wait for the Wizard to load the contents of the database. You will then be asked which parts of the database you want to be included in the DataSet. Since we will only be needing the tables, simply check the Tables. The DataSet name specifies the name of the DataSet to be created. Click finish to create the DataSet.
Database Connection 15
You can now see the created DataSet in the Data Sources Window. Expanding it shows the tables contained in the data set. Expanding a table shows its fields or columns. Visual Studio also generated 4 files grouped as one which is used to created the DataSet. You can see them in the Solution Explorer. They contain all the codes that creates our DataSet. You don't have to look at them for now.

Showing Table Data Via Drag and Drop

Now is the most exciting part. With our DataSet available in the Data Sources Window, we can simply drag a table to the form. You can also drag each column to a form but for now, we will drag a whole table to the form.
Database Connection 16
After dragging the table into the form, Visual Studio will automatically create a DataGridView control. The DataGridView allows you to view different kinds of data that can be represented in a table. An example is a database table or a multidimensional array of values. You can see that each column of the Students table was automatically placed in the DataGridView (try to resize the form and the DataGridView to see all the columns). You can also use the Dock property of the DataGridView and set it to Fill so the DataGridView will take up all the space of the form's client area.
You will a toolbar on the top of the form. It is called the BindingNavigator control and Visual Studio also created this to allow you to move through records, update a record, delete an old record, and add a new record. If you also look at the component try below, more components have been automatically created for you by Visual Studio. We won't be discussing each of them for now because there are lot's of concepts to learn first. But if you are to create everything manually, then it can take us a lot of time to create what we have accomplished in this lesson.
Run the application and you will see that all the records are displayed in the DataGridView. You can use the BindingSourceNavigator control to modify the contents of the database.
Database Connection 17
You can use the navigation buttons to move from 1 record to another. The plus icon allows you to add new records. Don't worry if the StudentID that will be assigned for the new record is a negative number, it will be fixed by clicking the Save button which should be done to save the changes to the database. You can modify each field of a record by double clicking it. You can also delete a selected record by clicking the red X icon in the BindingNavigator control. Again, press the Save button after you have made a change to send the changes to the database.
Note that running your program copies the database from the root project folder to the Release or Debug folder so everytime you run your program, you will be working with a fresh copy of the database. It means any modification to the database you make will be overwritten and discarded the next time you run your application. This is good when you are just developing the application. If you don't want this behavior, select the database file (University.mdf) in the Solution Explorer and in the find the Copy To Output Directory option in the Properties Window. Change its value to Copy if newer. The database file in the project's root directory will now only be coppied if it a newer version of the one that already exists in the output directory.

Lawmaker Kicks Against Jonathan’s $1bn Loan Request To Equip Military

The minority leader of House of Representatives, Femi Gbajabiamila, of the opposition party, has advised the Federal Government to explore ‘Trade by Barter option’ in its effort to step up military hardware and train military personnel instead of piling up debts.
Mr Gbajabiamila, who frowned at what he tagged ‘President Jonathan’s penchant for loans’ when the country had Sovereign Wealth Fund, reserve and excess oil revenue, said the one billion dollars loan which the President was requesting for was one loan too many for Nigeria’s future generation to pay-off and would not be granted.
In a statement issued by his media aide, Olanrewaju Smart, the lawmaker said that the President had earlier collected a loan of three trillion Naira allocated to defence in three years with nothing to show for it and advised the National Assembly not to grant the request while urging the Federal Government to try “exchanging oil for military hardware”.
Gbajabiamila cited the Al Yamamah Arms Deal between the Saudis and the UK, where a large amount of British military hardware was sold to the Saudi government for 600,000 barrels of crude oil daily, the oil for arms deal between China and Venezuela and the deal struck by the US in 2011 when over 80 F15 fighter jets were sold to the royal Saudi Air Force as example for Nigeria to emulate.
He, however, said that if the loan must be approved, clear explanations must be given for some issues such as the conditions for the loan, the repayment schedule and who bears the burden.
Other aspects of the loan he insisted must be explained are the practicability of the loan alongside government’s expenditure framework for the next three years and an immediate and a comprehensive audit of what has happened to all the funds allocated by the National Assembly to defence in the last 3 years among other things.