473,394 Members | 1,761 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

database problems

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

Jul 21 '05 #1
2 1258
Mike D <Mi***@discussions.microsoft.com> wrote:
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.


You should use a separate connection for each thing that you want to
do. Connection pooling will take care of the *real* underlying
connections.

Note that you should use try/finally to make sure that you *always*
close the connection, not just if you don't get any exceptions.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Jul 21 '05 #2
Thanks for the reply. I have not been using Try ... Finally but will look
into it.

Mike

"Jon Skeet [C# MVP]" wrote:
Mike D <Mi***@discussions.microsoft.com> wrote:
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.


You should use a separate connection for each thing that you want to
do. Connection pooling will take care of the *real* underlying
connections.

Note that you should use try/finally to make sure that you *always*
close the connection, not just if you don't get any exceptions.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too

Jul 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Mudge | last post by:
Hi, My hosting provider only allows me to use 50 connections to my MySQL database that my Web site will use. I don't know what this 50 connections means exactly. Does this mean that only 50...
3
by: cooldv | last post by:
i am running a website on Windows 2000 server with ASP 3 webpages and Access 2000 database. (with a hosting company) traffic is slow at this time but expect to grow. lately i have been reading...
0
by: Alex | last post by:
Hi all, I've been running a db2 V8.1 databasle to store my radius server accounting info for a *long* time and have never had any problems with it. Last week we had a power outage in our...
7
by: Andante.in.Blue | last post by:
Hello everyone! I've been working with a problematic legacy database for a while. While I am still fairly new to Access, the more I work with the database, the more problems I've uncovered. ...
3
by: Ryan Muller | last post by:
I have a database that I designed for the production floor of my company. One of the problems that I have encountered is that 2 or more users will try to access the database to enter information...
2
by: Jeff | last post by:
Does anyone know of any potential problems running a 2000 database with 2003? Also, what about installing all other Office products as 2003 versions but leaving Access as 2002 running a 2000...
3
by: MW de Jager | last post by:
I'm having endless problems with gaining access to an Access Database that sits on a different server. My ASP.NET app cannot gain control. The errror message I get is: The Microsoft Jet...
2
by: rustyc | last post by:
Well, here's my first post in this forum (other than saying 'HI' over in the hi forum ;-) As I said over there: ... for a little side project at home, I'm writing a ham radio web site in...
15
by: Bexm | last post by:
Hello I have searched through this forum and it seems some people are having similar problems to me but none of the fixes are fixing mine..! :( I have a table in my database that has two xml...
4
by: raidvvan | last post by:
Hi there, We have been looking for some time now for a database system that can fit a large distributed computing project, but we haven't been able to find one. I was hoping that someone can...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.