123 Eng

Engineering the engineers™


Latest Jobs   Forum Map

 


Home

Source Codes

Engineering Colleges

BE Students

Training  Reports (updated)

Seminar Reports (updated

Placement Papers (updated)

Forums

   Computer Science / IT

   Electronics

   Electrical

   Mechanical

   Chemical

   Civil

   CAT / MBA

   GMAT / Foreign MBA

Latest Jobs

Engineering Jobs / Technical Jobs

Management Jobs

Sitemap

About-Us

Terms of use

Displaying  Source Code(s)  
 

 
Table Builder

--------------------------------------------------------------------------------

Description : Generate an HTML table of any ODBC database by passing the dsn entry and the name of the table. You can paste the code into an activex dll.

Dim rs As ADODB.Recordset
Dim conn As ADODB.Connection
Public Function buildtable(dsn As String, table As String, Optional username As String, Optional password As String) As String
Dim sql As String
Dim flds As Integer
Set conn = New ADODB.Connection
Set rs = New ADODB.Recordset
conn.Open "dsn=" & dsn, username, password

sql = "select * from " & table

rs.Open sql, conn, 3, 3

flds = rs.Fields.Count


buildtable = buildtable & "<TABLE>" & vbCrLf
Do While Not rs.EOF
buildtable = buildtable & "<TR>" & vbCrLf

For i = 0 To flds - 1
buildtable = buildtable & "<TD>" & rs.Fields(i).Value & "</TD>"

Next
buildtable = buildtable & vbCrLf & "</TR>"
rs.MoveNext

Loop
rs.Close
Set rs = Nothing
buildtable = buildtable & vbCrLf & "</TABLE>"
End Function
 

 

Contribute content or training reports / feedback / Comments
job placement papers
All rights reserved © copyright 123ENG