Tuesday, February 21, 2012

ODBC Database connection using VB6 and ADO

1. Use a Cross cable to directly connect PC1 to PC2 or just connect the two PCs on your existing network.

Database Connection
1. Create ODBC Connection.
Let's say for example, PC2 is where your database is located and PC1 will be the one to establish a connection. From PC1 do the following:
a. Go to control panel + Administrative Tools + Data Sources (ODBC)
b. Click Add button to create a new data source. Select from the list of drivers available.
c. Name your data source and select the database to be used (remember to point this to PC2 database). For the data source name let us use myconnection

VB6 code:
1. Go to Project + References menu, check Microsoft ActiveX Data Objects 2.x (where x is the highest version that you have on your system) and click OK.
2. On form load event let us establish the connection with our database by using the dsn that we've created.
Option Explicit

Dim adoConn as ADODB.Connection
Dim adoRSet as ADODB.Recordset
Dim strSQL as string

'Instantiate
Set adoConn=new ADODB.Connection
'Database Connection string
'DSN is the name of your data source, Uid is the username and Pwd is the password

adoConn.ConnectionString="DSN=myconnection;Uid=admin;Pwd=;"
adoConn.Open

'execute sql select statement
strSQL="select * from table1;"
'instantiate recordset
Set adoRSet=new ADODB.Recordset
adoRSet.Open strSQL,adoConn
'go to 1st record
adoRSet.MoveFirst
do until adoRSet.EOF
'displays the first field of table1
'you can also re write the line below to - adoRSet.Fields("fname").Value
'using the actual field name in table1
Msgbox adoRSet.Fields(0).Value
'move to next record
adoRSet.MoveNext
loop
'close the connection
adoConn.Close
'clean up
Set adoRSet = Nothing
Set adoConn = Nothing




Saturday, February 11, 2012

innerHTML

innerHTML is useful for returning or replacing the content of HTML elements.

When you use innerHTML, you can change the page's content without refreshing the page. This can make your website feel quicker and more responsive to user input.
Syntax:
document.getElementById('{ID of element}').innerHTML = '{content}';

Example:
  

This will be replaced when you click the button - Replace Me

Friday, June 26, 2009

What's in the name...


Jyron - fine friend.
Kenneth - meaning fire born; good looking; handsome.
Ken - meaning strong, physically healthy.
Born under the sign of Gemini who turned 5 years old last June 2011.


Zack - meaning the lord remembers; sweet and polite and adorable.
Yrron - jyrell + ronaldo
Born under the sign of Scorpio who turned 4 years old last November 2011.

Roj - meaning peace or make peace.
Sebastian - revered.
Born under the sign of Cancer who just turned 1 year old last July 2011.