Please, Can an ADODC be set at runtime? 
Author Message
 Please, Can an ADODC be set at runtime?

I'm trying to use an ADO Data Control in my application and would like to
set it's properties at runtime.  I am reading the database connection
information at startup and need to apply them to the control at runtime.
The problem I have is that I keep getting errors from my ADODCs that say:
"Data source name not found and no default driver specified".  The control
is generating the error before I can set the information for the ADODC in my
Form_Load routine.

What can I do?  Is there a better way to set the SQL command, database,
username and password at runtime so that I can fill a datagrid?  I was
considering going the "unbound" route but it seems like a hassle and the
ADODC should do what I need, I just keep getting the error before I have a
change to trap it or supply the missing information to the control.

Thanks for any help you can give,

Curtis



Tue, 20 Nov 2001 03:00:00 GMT  
 Please, Can an ADODC be set at runtime?
Curtis,

This is what the MSDN help text says:
"At run time, you can dynamically set the ConnectionString and RecordSource
properties to change the database. Alternatively, you can set the Recordset
property directly to a  previously-opened recordset."

Have you set any of these properties at design-time? If so clear them and
try again.
--
Regards

VB-Joker
Carsten Thomsen/MCSE

PLEASE post ALL replies to the newsgroup(s) so we can all benefit from the
discussion!

Quote:
> I'm trying to use an ADO Data Control in my application and would like to
> set it's properties at runtime.  I am reading the database connection
> information at startup and need to apply them to the control at runtime.
> The problem I have is that I keep getting errors from my ADODCs that say:
> "Data source name not found and no default driver specified".  The control
> is generating the error before I can set the information for the ADODC in
my
> Form_Load routine.

> What can I do?  Is there a better way to set the SQL command, database,
> username and password at runtime so that I can fill a datagrid?  I was
> considering going the "unbound" route but it seems like a hassle and the
> ADODC should do what I need, I just keep getting the error before I have a
> change to trap it or supply the missing information to the control.

> Thanks for any help you can give,

> Curtis



Tue, 20 Nov 2001 03:00:00 GMT  
 Please, Can an ADODC be set at runtime?
Hi ,
You can set ADODC's properties at runtime . I have simulated your problem
and it workedfine for me . The error  "Data source name not found and no
default driver specified" occurs when you type something wrong in
ConnectionString property of the ADODC . Check the string which you are
assigning to ConnectionString property .
Here is the sample code which i used in simulating your problem ,

Private Sub Form_Load()
    Dim a As Adodc
    Set a = Adodc1
    a.ConnectionString = "DSN=Air-Reservation;UID=sa;PWD=;"
    a.RecordSource = "select * from flightdetails"
    a.Refresh
End Sub

Hope it will be a help to you.

Priya

Quote:

>I'm trying to use an ADO Data Control in my application and would like to
>set it's properties at runtime.  I am reading the database connection
>information at startup and need to apply them to the control at runtime.
>The problem I have is that I keep getting errors from my ADODCs that say:
>"Data source name not found and no default driver specified".  The control
>is generating the error before I can set the information for the ADODC in
my
>Form_Load routine.

>What can I do?  Is there a better way to set the SQL command, database,
>username and password at runtime so that I can fill a datagrid?  I was
>considering going the "unbound" route but it seems like a hassle and the
>ADODC should do what I need, I just keep getting the error before I have a
>change to trap it or supply the missing information to the control.

>Thanks for any help you can give,

>Curtis



Tue, 20 Nov 2001 03:00:00 GMT  
 Please, Can an ADODC be set at runtime?
Thanks for the comments.  The error is occurring before the Form_Load event.
I am able to set the connection string at runtime and change the record
source in the form_load event like your sample code is demonstrating.  The
problem I have is that the control is raising an error before I can set the
connection string and recordsource...before the Form_Load event.  Have you
seen this problem?  Any idea about what's going on?

Curtis


Quote:
> Hi ,
> You can set ADODC's properties at runtime . I have simulated your problem
> and it workedfine for me . The error  "Data source name not found and no
> default driver specified" occurs when you type something wrong in
> ConnectionString property of the ADODC . Check the string which you are
> assigning to ConnectionString property .
> Here is the sample code which i used in simulating your problem ,

> Private Sub Form_Load()
>     Dim a As Adodc
>     Set a = Adodc1
>     a.ConnectionString = "DSN=Air-Reservation;UID=sa;PWD=;"
>     a.RecordSource = "select * from flightdetails"
>     a.Refresh
> End Sub

> Hope it will be a help to you.

> Priya

> >I'm trying to use an ADO Data Control in my application and would like to
> >set it's properties at runtime.  I am reading the database connection
> >information at startup and need to apply them to the control at runtime.
> >The problem I have is that I keep getting errors from my ADODCs that say:
> >"Data source name not found and no default driver specified".  The
control
> >is generating the error before I can set the information for the ADODC in
> my
> >Form_Load routine.

> >What can I do?  Is there a better way to set the SQL command, database,
> >username and password at runtime so that I can fill a datagrid?  I was
> >considering going the "unbound" route but it seems like a hassle and the
> >ADODC should do what I need, I just keep getting the error before I have
a
> >change to trap it or supply the missing information to the control.

> >Thanks for any help you can give,

> >Curtis



Tue, 20 Nov 2001 03:00:00 GMT  
 Please, Can an ADODC be set at runtime?
My first thought was that the ADODC had stored my design time DSN name and
was looking for it before I got to set it to the current DSN in the
Form_Load routine.  I cleared the ConnectionString from the ADODC on my
development machine and started getting the "Data source name not found...."
error.  It seems that the control is trying to connect to the database when
it's created and that event occurs before the Form_Load event (where my code
is that sets the ConnectionString and RecordSource).

My application and ADODCs work fine after the ConnectionString and
RecordSource properties are set by my Form_Load routine but the controls
have already raised the error.  I'd try to trap the error but I don't think
I should have to and I'm don't know where to try to trap it...The Form_Load
error handler won't work because the error is raised before the Form_Load
event.

Curtis


Quote:
> Curtis,

> This is what the MSDN help text says:
> "At run time, you can dynamically set the ConnectionString and
RecordSource
> properties to change the database. Alternatively, you can set the
Recordset
> property directly to a  previously-opened recordset."

> Have you set any of these properties at design-time? If so clear them and
> try again.
> --
> Regards

> VB-Joker
> Carsten Thomsen/MCSE

> PLEASE post ALL replies to the newsgroup(s) so we can all benefit from the
> discussion!


> > I'm trying to use an ADO Data Control in my application and would like
to
> > set it's properties at runtime.  I am reading the database connection
> > information at startup and need to apply them to the control at runtime.
> > The problem I have is that I keep getting errors from my ADODCs that
say:
> > "Data source name not found and no default driver specified".  The
control
> > is generating the error before I can set the information for the ADODC
in
> my
> > Form_Load routine.

> > What can I do?  Is there a better way to set the SQL command, database,
> > username and password at runtime so that I can fill a datagrid?  I was
> > considering going the "unbound" route but it seems like a hassle and the
> > ADODC should do what I need, I just keep getting the error before I have
a
> > change to trap it or supply the missing information to the control.

> > Thanks for any help you can give,

> > Curtis



Tue, 20 Nov 2001 03:00:00 GMT  
 Please, Can an ADODC be set at runtime?
Have you tried clearing the RecordSource property as well?

--
Regards

VB-Joker
Carsten Thomsen/MCSE

PLEASE post ALL replies to the newsgroup(s) so we can all benefit from the
discussion!

Quote:
> My first thought was that the ADODC had stored my design time DSN name and
> was looking for it before I got to set it to the current DSN in the
> Form_Load routine.  I cleared the ConnectionString from the ADODC on my
> development machine and started getting the "Data source name not
found...."
> error.  It seems that the control is trying to connect to the database
when
> it's created and that event occurs before the Form_Load event (where my
code
> is that sets the ConnectionString and RecordSource).

> My application and ADODCs work fine after the ConnectionString and
> RecordSource properties are set by my Form_Load routine but the controls
> have already raised the error.  I'd try to trap the error but I don't
think
> I should have to and I'm don't know where to try to trap it...The
Form_Load
> error handler won't work because the error is raised before the Form_Load
> event.

> Curtis



> > Curtis,

> > This is what the MSDN help text says:
> > "At run time, you can dynamically set the ConnectionString and
> RecordSource
> > properties to change the database. Alternatively, you can set the
> Recordset
> > property directly to a  previously-opened recordset."

> > Have you set any of these properties at design-time? If so clear them
and
> > try again.
> > --
> > Regards

> > VB-Joker
> > Carsten Thomsen/MCSE

> > PLEASE post ALL replies to the newsgroup(s) so we can all benefit from
the
> > discussion!


> > > I'm trying to use an ADO Data Control in my application and would like
> to
> > > set it's properties at runtime.  I am reading the database connection
> > > information at startup and need to apply them to the control at
runtime.
> > > The problem I have is that I keep getting errors from my ADODCs that
> say:
> > > "Data source name not found and no default driver specified".  The
> control
> > > is generating the error before I can set the information for the ADODC
> in
> > my
> > > Form_Load routine.

> > > What can I do?  Is there a better way to set the SQL command,
database,
> > > username and password at runtime so that I can fill a datagrid?  I was
> > > considering going the "unbound" route but it seems like a hassle and
the
> > > ADODC should do what I need, I just keep getting the error before I
have
> a
> > > change to trap it or supply the missing information to the control.

> > > Thanks for any help you can give,

> > > Curtis



Wed, 21 Nov 2001 03:00:00 GMT  
 Please, Can an ADODC be set at runtime?
Yeah  I tried clearing the ADODC properties but it was still giving me
trouble.  I got it working by deleting the control and creating another one
in it's place.

Thanx,

Curtis


Quote:
> Have you tried clearing the RecordSource property as well?

> --
> Regards

> VB-Joker
> Carsten Thomsen/MCSE

> PLEASE post ALL replies to the newsgroup(s) so we can all benefit from the
> discussion!


> > My first thought was that the ADODC had stored my design time DSN name
and
> > was looking for it before I got to set it to the current DSN in the
> > Form_Load routine.  I cleared the ConnectionString from the ADODC on my
> > development machine and started getting the "Data source name not
> found...."
> > error.  It seems that the control is trying to connect to the database
> when
> > it's created and that event occurs before the Form_Load event (where my
> code
> > is that sets the ConnectionString and RecordSource).

> > My application and ADODCs work fine after the ConnectionString and
> > RecordSource properties are set by my Form_Load routine but the controls
> > have already raised the error.  I'd try to trap the error but I don't
> think
> > I should have to and I'm don't know where to try to trap it...The
> Form_Load
> > error handler won't work because the error is raised before the
Form_Load
> > event.

> > Curtis



> > > Curtis,

> > > This is what the MSDN help text says:
> > > "At run time, you can dynamically set the ConnectionString and
> > RecordSource
> > > properties to change the database. Alternatively, you can set the
> > Recordset
> > > property directly to a  previously-opened recordset."

> > > Have you set any of these properties at design-time? If so clear them
> and
> > > try again.
> > > --
> > > Regards

> > > VB-Joker
> > > Carsten Thomsen/MCSE

> > > PLEASE post ALL replies to the newsgroup(s) so we can all benefit from
> the
> > > discussion!


> > > > I'm trying to use an ADO Data Control in my application and would
like
> > to
> > > > set it's properties at runtime.  I am reading the database
connection
> > > > information at startup and need to apply them to the control at
> runtime.
> > > > The problem I have is that I keep getting errors from my ADODCs that
> > say:
> > > > "Data source name not found and no default driver specified".  The
> > control
> > > > is generating the error before I can set the information for the
ADODC
> > in
> > > my
> > > > Form_Load routine.

> > > > What can I do?  Is there a better way to set the SQL command,
> database,
> > > > username and password at runtime so that I can fill a datagrid?  I
was
> > > > considering going the "unbound" route but it seems like a hassle and
> the
> > > > ADODC should do what I need, I just keep getting the error before I
> have
> > a
> > > > change to trap it or supply the missing information to the control.

> > > > Thanks for any help you can give,

> > > > Curtis



Fri, 23 Nov 2001 03:00:00 GMT  
 Please, Can an ADODC be set at runtime?
If you set the ConnectionString at runtime you
have to set the RecordSource as well and ALL of
the fields that connect to Adodc1 with
DataSource=Adodc1

- yasmin



Quote:
> Yeah  I tried clearing the ADODC properties but

it was still giving me
Quote:
> trouble.  I got it working by deleting the

control and creating another one
Quote:
> in it's place.

> Thanx,

> Curtis


message

> > Have you tried clearing the RecordSource
property as well?

> > --
> > Regards

> > VB-Joker
> > Carsten Thomsen/MCSE

> > PLEASE post ALL replies to the newsgroup(s)

so we can all benefit from the
Quote:
> > discussion!

message

> > > My first thought was that the ADODC had

stored my design time DSN name
Quote:
> and
> > > was looking for it before I got to set it

to the current DSN in the
Quote:
> > > Form_Load routine.  I cleared the

ConnectionString from the ADODC on my
Quote:
> > > development machine and started getting the

"Data source name not
Quote:
> > found...."
> > > error.  It seems that the control is trying

to connect to the database
Quote:
> > when
> > > it's created and that event occurs before

the Form_Load event (where my
Quote:
> > code
> > > is that sets the ConnectionString and
RecordSource).

> > > My application and ADODCs work fine after

the ConnectionString and
Quote:
> > > RecordSource properties are set by my

Form_Load routine but the controls
Quote:
> > > have already raised the error.  I'd try to

trap the error but I don't
Quote:
> > think
> > > I should have to and I'm don't know where

to try to trap it...The
Quote:
> > Form_Load
> > > error handler won't work because the error

is raised before the
Quote:
> Form_Load
> > > event.

> > > Curtis


in message



Quote:
> > > > Curtis,

> > > > This is what the MSDN help text says:
> > > > "At run time, you can dynamically set the

ConnectionString and
Quote:
> > > RecordSource
> > > > properties to change the database.

Alternatively, you can set the
Quote:
> > > Recordset
> > > > property directly to a  previously-opened
recordset."

> > > > Have you set any of these properties at

design-time? If so clear them
Quote:
> > and
> > > > try again.
> > > > --
> > > > Regards

> > > > VB-Joker
> > > > Carsten Thomsen/MCSE

> > > > PLEASE post ALL replies to the newsgroup

(s) so we can all benefit from
Quote:
> > the
> > > > discussion!

message

read1.qis.net...
> > > > > I'm trying to use an ADO Data Control

in my application and would
Quote:
> like
> > > to
> > > > > set it's properties at runtime.  I am

reading the database
Quote:
> connection
> > > > > information at startup and need to

apply them to the control at
Quote:
> > runtime.
> > > > > The problem I have is that I keep

getting errors from my ADODCs that
Quote:
> > > say:
> > > > > "Data source name not found and no

default driver specified".  The
Quote:
> > > control
> > > > > is generating the error before I can

set the information for the
Quote:
> ADODC
> > > in
> > > > my
> > > > > Form_Load routine.

> > > > > What can I do?  Is there a better way

to set the SQL command,
Quote:
> > database,
> > > > > username and password at runtime so

that I can fill a datagrid?  I
Quote:
> was
> > > > > considering going the "unbound" route

but it seems like a hassle and
Quote:
> > the
> > > > > ADODC should do what I need, I just

keep getting the error before I
Quote:
> > have
> > > a
> > > > > change to trap it or supply the missing

information to the control.

Quote:

> > > > > Thanks for any help you can give,

> > > > > Curtis

Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


Fri, 14 Dec 2001 03:00:00 GMT  
 
 [ 8 post ] 

 Relevant Pages 

1. setting adodc database location runtime

2. Setting properties for ADODC during runtime...

3. HOW DO I Set ADODC Connection at Runtime?

4. Need Help: Setting ADODC control ConnectString at Runtime

5. Setting ADODC control's datasource at runtime

6. setting adodc cnxn string @ runtime

7. adodc - setting connectstring at runtime

8. adodc - error message - what am I missing?

9. Please, please help, I am desperated...:(

10. PLEASE, PLEASE HELP, am I going MAD - Generating Totals

11. adodc connection string atr runtime

12. Changing Adodc ConnectionString during runtime...

 

 
Powered by phpBB® Forum Software