Jump to content

Accessing a databse with a web service

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
2 replies to this topic

#1
xsonny

xsonny

    Newbie

  • Members
  • Pip
  • 8 posts
I have to access a SQL Database using a web service.

The web service can not be refrenced for some reason and I am unable to create any instances of it.

I would like to know if I would be able to use some class that can take a,
http://xxx.xxx.xxx.x:xxxx/blahblah.asxp?so_on_and_so_forth
string, and return the value to either an html, xml or excel document.

plz n thx

#2
xsonny

xsonny

    Newbie

  • Members
  • Pip
  • 8 posts
I'll explain better.

Basically i need to be able to do the following:


_______ srv = new _______();

srv.Execute("http://xxx.xxx.xxx.x:xxxx//blahblah.aspx");

//execute does not have to be the method name...

//You get the idea, i hope

The method has to display the information in some format

Display example (In Internet Browser):
name date study
steven 5/23/1989 5/18/07


I would like to know if there is a class that can do that or something similar to it. It can be displayed with XMl, HTML, Excel, ANYHTHING.

#3
xsonny

xsonny

    Newbie

  • Members
  • Pip
  • 8 posts
For any1 that would like to know the answer to this question...

            
Uri url = new Uri("http://xxx.xxx.xxx.x:xxxx/blahblah.aspx");
WebRequest request = WebRequest.Create(url);
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
logFile.write(response.StatusDescription);
Stream dataStream = response.GetResponseStream();
StreamReader reader = new StreamReader(dataStream);
string responseFromServer = reader.ReadToEnd();
Console.WriteLine(responseFromServer);

dont forget to close reder, datastream and response

now all you need to do is find an html reader
I'll have code for that in a bit =D