Wrox Programmer Forums
|
.NET Web Services Discussions about .NET XML Web Service technologies including ASMX files, WSDL and SOAP.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the .NET Web Services section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 24th, 2004, 10:30 AM
Registered User
 
Join Date: Apr 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default .getxml problem

I am trying to retreive some data from the SQLDatabase using the following code.

<WebMethod(Description:="This gets certain information about the chemical searching via the Chemical state")> _
       Public Function getChemicalState(ByVal sChemState As String) As String

        Dim connectionString As String = "server='(local)'; user id='username'; password='password'; database='Chemical'"
        Dim dbConnection As System.Data.IDbConnection = New System.Data.SqlClient.SqlConnection(connectionStri ng)

        Dim myCommand As SqlCommand
        myCommand = New SqlCommand("usp_ChemicalState", dbConnection)
        myCommand.CommandType = CommandType.StoredProcedure

        Dim dbParam_chemicalstate As SqlParameter = New SqlParameter("@ChemState", SqlDbType.NVarChar, 6)
        dbParam_chemicalstate.Value = sChemState
        myCommand.Parameters.Add(dbParam_chemicalstate)

        Dim myDataSet As New DataSet("GET_CHEMICAL_INFORMATION")
        Dim myDataAdapter As SqlDataAdapter = New SqlDataAdapter(myCommand)
        myDataAdapter.Fill(myDataSet)
        myDataSet.Tables(0).TableName = "CHEMICAL_INFORMATION"
        myDataSet.Tables(1).TableName = "TREATMENT_INFORMATION"

        Return myDataSet.GetXml

    End Function

When it is run and the search value is entered and you click invoke it then opens a web page and the error HTTP 500 Internal server error. Does anyone know where am going wrong.

Someday you eat the bar and sometimes the bar eats you
 
Old May 11th, 2004, 07:15 PM
Registered User
 
Join Date: May 2004
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Can you place a break point at the beginning of your function and then run it in debug mode? Then you can step through the code and find the exact statement that errors out.

-Manish Jadhav











Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.