Web Service won't run when called from aspx

nodavies

Member
Joined
Jun 3, 2005
Messages
6
Location
New Orleans
Programming Experience
10+
Hi all,

Got another one that is driving me crazy, I've created a Web Service that hits a SQL server database, and runs without a problem. However, when I call it via this aspx all I get is a title. The web service was included with a web reference without a problem - so I'm kinda at a loss...anyone have any ideas?

<%@ Page Language="vb" AutoEventWireup="false" Codebehind="DisplayMaterial.aspx.vb" Inherits="DisplayMaterial.WebForm1"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<script language="VB" runat="server">
Sub Page_Load(Source As Object, E As EventArgs)
Dim objMaterialService As New DisplayMaterial.localhost.Material()

dgrdMaterial.DataSource = objMaterialService.getMaterial()
dgrdMaterial.DataBind()
End Sub
</script>
<HTML>
<HEAD>
<title>Display Material</title>
</HEAD>
<body>
<h2>Material</h2>
<asp:DataGrid ID="dgrdMaterial" Runat="server" />
</body>
</HTML>
 
first of all u miss few things while posting the question like atleast the header of ur webservice (i mean it is required what is being return from operation, let me suppose that it is "DataSet" )
so i just made a simple method to show you that its working quite ok so let inform me if u r having more problem
here is service

<WebMethod()> _

Public Function GetDataSet() As System.Data.DataSet

Dim ds As New DataSet

Dim adap As New SqlClient.SqlDataAdapter

SqlConnection1.Open()

adap.SelectCommand =
New SqlClient.SqlCommand("Select * from news", SqlConnection1)

adap.Fill(ds)

SqlConnection1.Close()

Return ds

End Function

and here i syour aspx's load event

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

Dim s As New MyServ.Service1
Me.DataGrid1.DataSource = s.GetDataSet()
Me.DataBind()
End Sub



 
Back
Top