can .net activex communicate with database using ASP.net/ADO

T

tuvman

We are developing a web application. Our web app is a heavy client-
our existing .net app exposed as an activex control running in IE. We
need the activex to be able to access our remote database server when
hosted within a browser from anywhere.Originally we were planning on
using port forwarding...and having the externalip:databaseport forward
from the web server to the database server. But our customer's network
admin says this is not possible and everything must go through the web
server..port 80.

We have dozens of stored procedures and dozens of methods written
already which use ADO.NET. Is it possible to connect to ASP.NET using
ADO, execute a request on the database server, and then return the
results as an ADO.net resultset? If not how would you propose we have
the ActiveX communicate with the database without having to write a
lot of code on both the client and server side.

thanks,
Tuviah
 
G

George

Probably the easiest way is to build custom Stub/Proxy

So lets say you have GetData.aspx which takes parameter SQL that is just run
agains SQL database.
And this GetData.aspx does something like
DataTabe.WriteXml(Response.OutputStream)

On client side if you have your ActiveX written on .NET you could


HttpWebRequest req =
WebRequest.Create("http://www.myserver.com/GetData.aspx?SQL" )
......
Stream st = req.GetResponse().GEtResponse.Stream();
DataTable.ReadXml(stream)
....

I hope you got an idea....
You will need to somehow make is secure though, so people could not delete
your database (by accident :)


George.
 
A

Alvin Bruney [ASP.NET MVP]

ActiveX controls in .NET don't exist. But your approach is workable. Another
approach would be to write a web service sitting on the server that does the
query to the database. The activex control can query the webserice using
xmlhttp or something similar. That approach is safer because the activex
doesn't know about the database. The webservice handles the 'forwarding' and
is hosted on your secure server.

--

Regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
Download OWC Black Book, 2nd Edition
Exclusively on www.lulu.com/owc $15.00
Need a free copy of VSTS 2008 w/ MSDN Premium?
http://msmvps.com/blogs/alvin/Default.aspx
 
T

tuvman

Probably the easiest way is to build custom Stub/Proxy
So lets say you have GetData.aspx which takes parameter SQL that is just run
agains SQL database.
And this GetData.aspx does something like
Can you give me more details on this approach? How do I get ASP to
execute the query and return an ADO recordset? Also won't we have to
make major changes to the way we are executing stored procedures (we
ADO Command and parameters object).

I also started reading a little about passing data over web services.
Is this something to consider?

thanks,
Tuviah
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top