Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pass dataset from websevice to pocket pc

Status
Not open for further replies.

jayy66

Programmer
Aug 21, 2006
56
US
Hello everyone,
I've been trying to return a dataset from a webservice to a client app on pocket pc emulator. The webservice works fine when i run it on the local host but when i try accessing it on Internet Explorer i get the following error when i hit the invoke button:

System.InvalidOperationException: Showing a modal dialog box or form when the application is not running in UserInteractive mode is not a valid operation. Specify the ServiceNotification or DefaultDesktopOnly style to display a notification from a service application.
at System.Windows.Forms.MessageBox.ShowCore(IWin32Window owner, String text, String caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton, MessageBoxOptions options, Boolean showHelp)
at System.Windows.Forms.MessageBox.Show(IWin32Window owner, String text, String caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton, MessageBoxOptions options)
at Microsoft.VisualBasic.Interaction.MsgBox(Object Prompt, MsgBoxStyle Buttons, Object Title)
at Service.ReturnData()

Below is the code for the webservice:

Code:
Imports System.Web
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.Data
Imports System.Data.SqlClient

<WebService(Namespace:="[URL unfurl="true"]http://tempuri.org/")>[/URL] _
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Public Class Service
    Inherits System.Web.Services.WebService

    <WebMethod()> _
    Public Function ReturnData() As DataSet
        Dim sqlconnection1 As New SqlConnection
        Dim SqlCmd As New SqlClient.SqlCommand
        Dim SqlDA As New SqlClient.SqlDataAdapter
        Dim DS As New DataSet
        Dim DB_ServerName As String
        Dim DB_Catalog As String
        Dim DB_password As String
        Dim DB_userID As String
        'Dim DB_Packet As String
        'Dim DB_PersistSec As String
        Dim workstationid As String
        Dim ConnectionString As String = ""

        Try
            DB_ServerName = GetSetting("TMC", "EMRUserManagementSettings", "datasource")
            DB_Catalog = GetSetting("TMC", "EMRUserManagementSettings", "intcat")
            DB_userID = GetSetting("TMC", "EMRUserManagementSettings", "user")
            DB_password = GetSetting("TMC", "EMRUserManagementSettings", "passwrd")
            workstationid = Environment.MachineName

            ConnectionString = "workstation id=" & workstationid & ";user id=" & DB_userID & ";data source=" & DB_ServerName & ";initial catalog=" & DB_Catalog & ";password=" & DB_password

            SqlCmd = sqlconnection1.CreateCommand
            SqlCmd.CommandType = CommandType.StoredProcedure
            SqlCmd.CommandText = "PDAtest"

            SqlDA.SelectCommand = SqlCmd

            If sqlconnection1.State <> ConnectionState.Open Then
                sqlconnection1.ConnectionString = ConnectionString
                sqlconnection1.Open()
            End If

            SqlCmd.ExecuteNonQuery()

            SqlDA.SelectCommand = SqlCmd
            SqlDA.Fill(DS, "PatientProfile")

            Return DS
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
    End Function

End Class


Can anyone help me out??

Thanks
 
Thanks that got rid of the error.
However, i have a new problem...when i run the webservice it works fine, the dataset is returned with the proper data but when i make the webservice public...nothing gets returned into the dataset.

Any suggestions? [sadeyes]
 
Excuse my ignorance but what do mean?? As far as i know my machine has always had permissions to hit the server.
is there a way for me to check??
 
All web services run as the "ASP.Net" user. So you'll need to go into Enterprise Manager and add the ASP.Net user to the security for what ever tables/stored procs it needs access to. You might want to check the ASP.Net forum and FAQ, I know it's a topic that comes up quite often over there.

-Rick

VB.Net Forum forum796 forum855 ASP.NET Forum
[monkey]I believe in killer coding ninja monkeys.[monkey]
 
Thanks Rick, I appreciate your input.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top