Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsVB SyntaxEnterprise DevelopmentDatabase AccessControlsCOMWin APICrystal ReportDeploymentGeneralGeneral 2
Related Topics
VB.NET / ASP.NETMS SQL ServerMS AccessOther Database ProductsMore Topics ...

VB Forum / Database Access / November 2004



Tip: Looking for answers? Try searching our database.

Event Disconnect

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
nicolau - 22 Nov 2004 15:01 GMT
Hi there,
I use the event following:

Private Sub Connect_WillConnect(ConnectionString As String, UserID As
String, Password As String, Options As Long, adStatus As
ADODB.EventStatusEnum, ByVal pConnection As ADODB.Connection)
  ' Dichiara le variabili.
 
  ConnectionString = "Provider=MSDataShape;" & _
                     "Data Provider=Microsoft.Jet.OLEDB.4.0;" & _
                     "Data Source= " & Main.Path_Archivio & ";" & _
                     "User ID=Admin;Jet OLEDB:Database Password=02;"

End Sub

Now, if I change year of reference, then I need to disconnect the event
WillConnect because I need to connect to another database.

How can I do this ?
Val Mazur - 22 Nov 2004 23:50 GMT
Hi,

What do you mean when you say 'if I change year of reference"? Could you be
more specific? Do you mean that you are switching your application to
another version of ADO? If yes, then you need to re-define ADO events only
in a case if you migrate from very old version of ADO - 2.0 and 2.1. It
should work with any other versions of ADO without any changes.

Signature

Val Mazur
Microsoft MVP

> Hi there,
> I use the event following:
[quoted text clipped - 15 lines]
>
> How can I do this ?
nicolau - 24 Nov 2004 11:51 GMT
No, I wont to switch my application to another version of ADO, but I need to
change database from Archive_2004 to Archive_2005 and reciprocal.
All this because I could connect my application to database Archive_2004
before and in any moment to database Archive_2005.
Therefore how can I disconnect the connection to the database Archive_2004
and to connect to the database Archive_2005 ?  

Thank so much.

> Hi,
>
[quoted text clipped - 23 lines]
> >
> > How can I do this ?
Val Mazur - 25 Nov 2004 02:23 GMT
Hi,

Did you hardcode database name into connection string of you application? If
yes, then it is not a good idea. What you need to do is to create some sort
of login, which will prompt user for the database and/or user name with the
password or you could keep database name somewhere in a registry or
configuration file. Then you need to build your connection string
dynamically based on these settings. This is the only way to make your
application flexible to connect to different databases

Signature

Val Mazur
Microsoft MVP

> No, I wont to switch my application to another version of ADO, but I need
> to
[quoted text clipped - 35 lines]
>> >
>> > How can I do this ?
nicolau - 25 Nov 2004 14:25 GMT
Hi,
I have created an application where the user register some records for the
year 2004, but for the year 2005 he must register other records but not same
database.
Therefore for the year 2004 I use a database called Archive_2004 e for the
year 2005 I use a database called Archive_2005.
Now the user could need to read some records from database Archive_2004 or
Archive_2005 or Archive_2006 etc, etc.

Is now more specific ?
If I use the WillConnect method how can I use the Disconnect method so I
close the database Archive_2004 and open Archive_2005 for example ?

Thank so much for any help me !!!

"Val Mazur" ha scritto:

> Hi,
>
[quoted text clipped - 45 lines]
> >> >
> >> > How can I do this ?
nicolau - 30 Nov 2004 08:53 GMT
Hi there,
is possible to have another help ?

Thanks a lot.

> Hi,
> I have created an application where the user register some records for the
[quoted text clipped - 62 lines]
> > >> >
> > >> > How can I do this ?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.