G
Guest
I am using oracle, not by choice. I am getting some errors that I can't debug.
I have my db stuff in a module with public functions named database.vb
Then I am trying to call the function from a form like this:
Private Sub Main_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim iPortNumber As Short
iPortNumber = CType(GetPortNumber(glbstrAssistLogin), Short)
End Sub
I am getting a big error on debug that I won't even try and type here. My
question is should I approach it like this or should I have a connection on
any form that I use a connection on. That seems wasteful but I am missing
something. The connection string is correct because I can use it on a page
that has it's own connection.
Thanks for any advice
Mike
database.vb:
------------------------------------------------------------------------
Imports System.Data.OracleClient
Module database
Public oraConn As New System.Data.OracleClient.OracleConnection
Public Function OpenOradb(ByVal str As String)
oraConn.ConnectionString = str
oraConn.Open()
End Function
Public Function CloseOradb()
oraConn.Close()
End Function
Public Function GetPortNumber(ByVal str As String) As String
Dim oraComm1 As New System.Data.OracleClient.OracleCommand
OpenOradb(str)
CloseOradb()
Return 2
End Function
Public Function GetBalanceID(ByVal str As String) As String
Return "Boo"
End Function
End Module
I have my db stuff in a module with public functions named database.vb
Then I am trying to call the function from a form like this:
Private Sub Main_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim iPortNumber As Short
iPortNumber = CType(GetPortNumber(glbstrAssistLogin), Short)
End Sub
I am getting a big error on debug that I won't even try and type here. My
question is should I approach it like this or should I have a connection on
any form that I use a connection on. That seems wasteful but I am missing
something. The connection string is correct because I can use it on a page
that has it's own connection.
Thanks for any advice
Mike
database.vb:
------------------------------------------------------------------------
Imports System.Data.OracleClient
Module database
Public oraConn As New System.Data.OracleClient.OracleConnection
Public Function OpenOradb(ByVal str As String)
oraConn.ConnectionString = str
oraConn.Open()
End Function
Public Function CloseOradb()
oraConn.Close()
End Function
Public Function GetPortNumber(ByVal str As String) As String
Dim oraComm1 As New System.Data.OracleClient.OracleCommand
OpenOradb(str)
CloseOradb()
Return 2
End Function
Public Function GetBalanceID(ByVal str As String) As String
Return "Boo"
End Function
End Module