connect to SQLserver Database


T

ton_cul

I am very new to programming (2 months). I have followed an example
(http://support.microsoft.com/kb/815672) to create a simple XML WebService.
The example uses Visual Studio 2005. I am using VS 2008, Express SQLserver
2005.

After I finished creating my WebService, I tested it by right clicking on
the .asmx file and selecting "View in Browser". In the webpage I clicked on
the Web-Method "GetProductsData", it goes to the TEST page, and next I
clicked the button "Invoke" which does not work (The "Invoke" button should
show me a web page containing XML data from the Northwind Product table from
an SQLserver database but instead I get a webpage with an error message "Web
Site cannot display page". Then, I clicked the "Refresh the Page" button and
got a different error message "Exception Details:
System.InvalidOperationException: Request format is unrecognized for URL
unexpectedly ending in '/GetProductsData'.")

I know that the Web Service is working because when I test it by clicking
the Web-Method "Hello World", and next the "Invoke" test button, it works
perfectly (I get a webpage having XML containing the string "HELLO WORLD").
Please Note that the "Hello World" Web-Method does not need to Query the
database to return a value so the problem is not with the webservice it is
with the connection between the webservice and the database.

I believe that the problem is that the WebService is not able to communicate
with the SQLserver database at runtime. At design time, I am able to
"preview" the data from the database using the SqlDataAdapter. At runtime, I
dont know if the DataAdapter's Fill method is actually filling the "DataSet"
though.

Does anyone know of a simple example using Visual Studio 2008, in C#,
that WORKS which I can follow to make a WebService that can render data from
a SqlServer 2005 Database???
 
Ad

Advertisements


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