Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: Changing the data source


Message #1 by "Jonathan Charlton" <jcharlton@e...> on Mon, 22 Jul 2002 16:22:59 +0100
I am trying to execute some code where the user has the ability to specify
the data source from a drop down box (no problems here as you might
imagine). However I am accessing some stored procedures that are held in one
but not all of the datasources on the page. Is there anyway that I can have
the same page accessable from all datasources but not throwing an error when
I select a datasource that doesnt contain the required Sprocs.

I understand that this is a pritty odd request but all help will be
gratefully received.

Regards

Jonathan


Message #2 by "Kim Iwan Hansen" <kimiwan@k...> on Tue, 23 Jul 2002 18:15:29 +0200
Try this - works on my system, but of course could be different for you.

on error resume next
Set cn = Server.CreateObject("ADODB.Connection")
cn.open "Provider=SQLOLEDB; Data Source=ipaddress; Initial
Catalog=catalogname; User ID=xxxxxxxx; Password=xxxxxx"
set rs = cn.execute("EXEC sp_foo")
cn.close
set rs = nothing
set cn = nothing
Response.Write(err.description)

-Kim


> -----Original Message-----
> From: Jonathan Charlton [mailto:jcharlton@e...]
> Sent: 23. juli 2002 16:16
> To: ASP Databases
> Subject: [asp_databases] RE: Changing the data source
>
>
> Normally I would do this but for some strange reason when I am trying to
> access Stored Procedures then the error is not thrown if I set on error to
> resume next. Instead the dllhost.exe process goes skywards and the server
> crashes like I have some kind of crazy infinate loop going on
> (which I dont
> have!!).
>
> Any suggestions on how I might get around this one?
>
> -----Original Message-----
> From: Kim Iwan Hansen [mailto:kimiwan@k...]
> Sent: 23 July 2002 01:34
> To: ASP Databases
> Subject: [asp_databases] RE: Changing the data source
>
>
> Can't you just do normal error trapping using on error resume next, and
> then, after you've tried to retrieve the data, check if an error has been
> thrown? - If there was an error, take the necessary action.
>
> -Kim
>
> > -----Original Message-----
> > From: Jonathan Charlton [mailto:jcharlton@e...]
> > Sent: 22. juli 2002 17:23
> > To: ASP Databases
> > Subject: [asp_databases] Changing the data source
> >
> >
> > I am trying to execute some code where the user has the ability
> to specify
> > the data source from a drop down box (no problems here as you might
> > imagine). However I am accessing some stored procedures that are
> > held in one
> > but not all of the datasources on the page. Is there anyway that
> > I can have
> > the same page accessable from all datasources but not throwing an
> > error when
> > I select a datasource that doesnt contain the required Sprocs.
> >
> > I understand that this is a pritty odd request but all help will be
> > gratefully received.
> >
> > Regards
> >
> > Jonathan
> >
> >
> >
>
>
>
>
>

Message #3 by "Jonathan Charlton" <jcharlton@e...> on Tue, 23 Jul 2002 15:15:44 +0100
Normally I would do this but for some strange reason when I am trying to
access Stored Procedures then the error is not thrown if I set on error to
resume next. Instead the dllhost.exe process goes skywards and the server
crashes like I have some kind of crazy infinate loop going on (which I dont
have!!).

Any suggestions on how I might get around this one?

-----Original Message-----
From: Kim Iwan Hansen [mailto:kimiwan@k...]
Sent: 23 July 2002 01:34
To: ASP Databases
Subject: [asp_databases] RE: Changing the data source


Can't you just do normal error trapping using on error resume next, and
then, after you've tried to retrieve the data, check if an error has been
thrown? - If there was an error, take the necessary action.

-Kim

> -----Original Message-----
> From: Jonathan Charlton [mailto:jcharlton@e...]
> Sent: 22. juli 2002 17:23
> To: ASP Databases
> Subject: [asp_databases] Changing the data source
>
>
> I am trying to execute some code where the user has the ability to specify
> the data source from a drop down box (no problems here as you might
> imagine). However I am accessing some stored procedures that are
> held in one
> but not all of the datasources on the page. Is there anyway that
> I can have
> the same page accessable from all datasources but not throwing an
> error when
> I select a datasource that doesnt contain the required Sprocs.
>
> I understand that this is a pritty odd request but all help will be
> gratefully received.
>
> Regards
>
> Jonathan
>
>
>




Message #4 by "Kim Iwan Hansen" <kimiwan@k...> on Tue, 23 Jul 2002 02:33:50 +0200
Can't you just do normal error trapping using on error resume next, and
then, after you've tried to retrieve the data, check if an error has been
thrown? - If there was an error, take the necessary action.

-Kim

> -----Original Message-----
> From: Jonathan Charlton [mailto:jcharlton@e...]
> Sent: 22. juli 2002 17:23
> To: ASP Databases
> Subject: [asp_databases] Changing the data source
>
>
> I am trying to execute some code where the user has the ability to specify
> the data source from a drop down box (no problems here as you might
> imagine). However I am accessing some stored procedures that are
> held in one
> but not all of the datasources on the page. Is there anyway that
> I can have
> the same page accessable from all datasources but not throwing an
> error when
> I select a datasource that doesnt contain the required Sprocs.
>
> I understand that this is a pritty odd request but all help will be
> gratefully received.
>
> Regards
>
> Jonathan
>
>
>


  Return to Index