none
how to show the table data into data grid view , please help me in this WCF RRS feed

  • Question

  • this is my basic data logic class

    Public Function GetPersonTable() As DataTable
    Dim oConn As New Informixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

    Dim dtTable As New DataTable
    Try
    oConn.OpenDB()


    Dim person = oConn.SelectQueryIntoTable("select * from person", dtTable)

    Return dtTable

    Catch ex As Exception
    Throw New System.Exception(ex.Message)

    Finally
    oConn.CloseDB()

    End Try

    End Function

    this is Iservice file code

    <OperationContract()> _

    Function GetPersonTable(ByVal value As Integer) As DataTable

    this is service.svc

    Public Function GetPersonTable(ByVal value As Integer) As DataTable Implements IService1.GetPersonTable

    Dim oDL As New Datalogic.Class1
    Return oDL.GetPersonTable


    End Function

    Public Class Form1

                   

        Private Sub Button1_Click(sender As Object, e As EventAr

    gs) Handles Button1.Click
            Dim oProxy As New ServiceReference1.Service1Client
            Dim ds As New DataTable

            For i = 1 To 2

                MessageBox.Show(oProxy.GetData(i))
            Next
    DataGridView1.DataSource = oProxy.GetPersonTable(1000)

            Dim b1 As New BindingSource()
            Dim d1 As New DataGridView()
            b1.DataSource = oProxy.GetPersonTable(1000)
            d1.DataSource = b1
            DataGridView1.DataSource = oProxy.GetPersonTable(1000)

            TextBox1.Text = "Record Saved Successfully"

        End Sub

    can anyone please help me to tackle this exception??????????


    Monday, July 28, 2014 2:15 PM

Answers

All replies

  • this is my basic data logic class

    Public Function GetPersonTable() As DataTable
    Dim oConn As New Informixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

    Dim dtTable As New DataTable
    Try
    oConn.OpenDB()


    Dim person = oConn.SelectQueryIntoTable("select * from person", dtTable)

    Return dtTable

    Catch ex As Exception
    Throw New System.Exception(ex.Message)

    Finally
    oConn.CloseDB()

    End Try

    End Function

    this is Iservice file code

    <OperationContract()> _

    Function GetPersonTable(ByVal value As Integer) As DataTable

    this is service.svc

    Public Function GetPersonTable(ByVal value As Integer) As DataTable Implements IService1.GetPersonTable

    Dim oDL As New Datalogic.Class1
    Return oDL.GetPersonTable


    End Function

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
    Dim oProxy As New ServiceReference1.Service1Client
    Dim ds As DataTable

    For i = 1 To 2

    MessageBox.Show(oProxy.GetData(i))
    Next
    Console.WriteLine(oProxy.GetPersonTable(10002))  here is showing the exception????????


    End Sub

    please help me in this regard i am working from days but nothing working.


    Monday, July 28, 2014 12:39 PM
  • Well, you don't start dragging datasets and datatables around in WCF.

    What you do is send a List Of<T> of custom objects

    http://visualbasic.about.com/od/usingvbnet/a/genericlist.htm

    What you send is a single custom object or a List Of<T> of custom object's that are Datacontracts to WCF. WCF uses Datacontracts

    http://msdn.microsoft.com/en-us/library/vstudio/system.runtime.serialization.datacontractserializer(v=vs.100).aspx

    That custom object is a Data Transefer Object, which is based on auto properties. The DTO is a datacontract using datamember attributes for each property.

    http://msdn.microsoft.com/en-us/library/dd293589.aspx

    If it was employee data being sent, the custom class/object would be called DtoEmployee.

    http://en.wikipedia.org/wiki/Data_transfer_object

    DtoEmployee would be in a classlib project called Entities, and the WCF client and service project would have reference to Entites and know what DtoEmployee was about, which is a searlizable datacontract to WCF.

    Monday, July 28, 2014 3:36 PM
  • Usually the exception dialog contains some details that can help. Which details do you see?

    In order to not lose valuable information, remove these lines:

    Catch ex As Exception
        Throw New System.Exception(ex.Message)

    Tuesday, July 29, 2014 6:32 AM