<WebMethod()> _
Public Function TrackYourDelivery(ByVal barcode As String) As DataTable
Dim sqlconn As SqlConnection = New SqlConnection(strconn)
sqlconn.Open()
Dim strcommand As String = "select * from v_tran_tracking_operations where MailItemCode ='" & barcode & "'"
Dim sqlcommand As SqlCommand = New SqlCommand(strcommand, sqlconn)
Dim dt As DataTable = New DataTable("Tracking_operations")
Dim da As SqlDataAdapter = New SqlDataAdapter(sqlcommand)
Dim dataSet As DataSet = New DataSet
da.Fill(dataSet, "Tracking")
dt = dataSet.Tables(0)
Return dt
sqlconn.Close()
End Function
and here is where i call the webmethod
Private Sub btn_tracking_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_tracking.Click
Dim obj As New Service1SoapClient
DataGridView1.DataSource = obj.TrackYourDelivery(txt_tracking.Text)
End Sub
It doesnt happen anything after i press the button and i dont understand why. I try calling the default webmethod which returns "Hello World" and it works properly, it means that i have added the right references of the webservice to the project. I copyed the same function of the web method into another button of the form and it works ok.
Can anyone give me some help about this? i really dont get what is wrong with my code. Thanks a lot for your time

New Topic/Question
Reply


MultiQuote



|