Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

To: mrmick

Posted on 1998-05-30
6
Medium Priority
?
202 Views
Last Modified: 2010-05-03
Hi Top expert:
Do you think you can help? I'm trying to disconnect previous oracle session using VB4 before I start a new connection.
 
Scenario:
I have a logon screen which capture user id and password and with the captured values, I will do a ODBC connection to Oracle Unix. Once the connection has been established, I will call a sub routine to check if this user is an authorised user.If negative (ie he is not authorised), then I would expect this ODBC connection to be disconnected and my logon screen to be invoked again to capture new userid and password. Now with these  new values, I will therefore do a connection to Oracle Unix again and check if he or she is authorised and.....

Problems faced
example:when user A logon with his id "kt_wong" (A is not a valid user), oracle connetion establised, sub routine called and found out he is a invalid user. Therefore logon screen will invoke and warning message sound. So if now A key in id "kt_chan" (valid user id) instead of "kt_wong", same thing connection establised and sub rountine called. But this time my sub routine encounter ODBC error cos I have realised my "kt_wong" session has not been disconnected and my sub routine is executing the sql command using kt_chan but yet still within kt_wong oracle session.

Objective:
Therefore I hope to always disconnect any previous session (eg kt_wong) first before I connect a new session (eg kt_chan) using the opendatabase method.

My ways of doing it
Dim db as database,rs as recordset,connect as string
connect="ODBC;DSN=oracle;uid='" & text1.text & "',pwd='" & text2.Text & "';"
set db=opendatabase("",false,false,connect)
I have try using rs.close and db.close but still I could not physically end the previous oracle session. Please help
0
Comment
Question by:teck
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 1

Accepted Solution

by:
fujicast earned 600 total points
ID: 1462130
Hi,

Hi ! try this way :

Set RS = Nothing ; THis makes recordset object removes from mem
Set DB = nothing ' This makes the database object removes from memory and clear all ODBC connection which it has made.

Hope this help.

Regards,
Fuji

for future consultation please fell free to e-mail me at fujihome@hotmail.com
0
 

Author Comment

by:teck
ID: 1462131
Hi fujicast,
    just to clarify, when you say
Set Rs=Nothing and set db=nothing. Does it mean

Set rs="" and set db="". Is it possible for you to give me a more specfic codes. Sorry for my limited knowledge, Is nothing a keyword and by the way where would be the best to place these two lines of codes. Please advise. Thanks a million.
0
 

Author Comment

by:teck
ID: 1462132
Please give me some time to try out the codes that you have provided. Your kindness is very much appreciated.
Thanks
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 6

Expert Comment

by:clifABB
ID: 1462133
teck:
What fujicast means is exactly what he says:
Set RS = Nothing
Set DB = Nothing

'Nothing' is a keyword in VB that causes the contants of an object variable to be removed from memory.

As an added note, you might want to close the recordset and database first.  You don't *have* to, but it's good programming practice.
0
 
LVL 9

Expert Comment

by:Dalin
ID: 1462134
teck,
If you are just look for anwers to a question, address to a special expert is not a good idea. You may not get a answer in a timely manner or not getting a answer at all, because the expert you adrress to may be out of town for some time, or he may not have the expertise on your particular question, or he may not be actively involded in EE at all. Because your question titled "To somebody", other expert may not bother to look at it.
I know mrmick was on trip for sometime and he may (just maybe) not be able to back to EE for a while.
0
 

Author Comment

by:teck
ID: 1462135
Hi fujicast,
  Thank you for being so helpful and sincere. Thanks
Best wishes,
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

609 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question