Saturday, December 16, 2017

vb and oracle connection

Dim Oracon As ADODB.Connection
Dim recset As New ADODB.Recordset
Dim objErr As ADODB.Error
Dim Message, Title, Default, EmpNoValue
Dim EID As Integer, EName As String, EHeight As Integer
Dim EEmail As Strin, EWeight As Integer, EBloodType As String

i = 0
On Error GoTo err_test
Set Oracon = CreateObject("ADODB.Connection")
Oracon.ConnectionString = "Provider=OraOLEDB.Oracle;" & "Data Source=sigma;" & _
"User ID=sigma;" & "Password=sigma;" & "PLSQLRSet=1;"
Oracon.Open
Set recset = New ADODB.Recordset
recset.Open "EMPLOYEES", Oracon, adOpenDynamic, adLockOptimistic
With recset
If Not (.BOF And .EOF) Then
While Not .EOF
EID = recset.Fields("employeeid").Value
EName = recset.Fields("employeename").Value
EHeight = recset.Fields("height").Value
EEmail = recset.Fields("email").Value
EWeight = recset.Fields("weight").Value
List1.AddItem EID & " " & EName & " " & EHeight & " " & EEmail & " " & EWeight
.MoveNext
Wend
End If
recset.Close
End With
Exit Sub
err_test:
MsgBox Error$
For Each objErr In Oracon.Errors
MsgBox objErr.Description
Next
Oracon.Errors.Clear
Resume Next
End Sub

Making Report Using JSP

U can generate a report in servlet . Simpley u execute the query in servlet and print the resultset in servlet.using printWriter object. Now the output will come in html format.

if u want the same output in excel then put

response.setContentType("application/vnd.ms-excel");
for pdf output put

response.setContentType("text/pdf");

Don't use jsp directly to display a report as it may print some unwanted comments.

Otherwise u can go 4 some reporting tools like jasperreport ,ireport or pentaho reports

all these are open source tools so u can download them

Only u have to learn how to make reports using these tools

try pentaho.org