locked
objectdatasource problem RRS feed

  • Question

  • User-788967271 posted

    Hi all:

    I have:

    <asp:ObjectDataSource ID="objdsobras" TypeName="comercial.obras_cresolia" SelectCountMethod="seleccionar_cuenta" EnablePaging="true" SelectMethod="seleccionar_todo" StartRowIndexParameterName="comienzo" MaximumRowsParameterName="maximonumeroregistros" SortParameterName="orden" runat="server" >

    <SelectParameters>

    <asp:Parameter Name="condicion" />

    <asp:QueryStringParameter Name="obra" QueryStringField="obra" />

      <asp:QueryStringParameter Name="idioma" QueryStringField="idioma" />

      </SelectParameters>

    In app_code I have

    Public Class obras_cresolia

     Public Function seleccionar_todo(ByVal obra As Integer, ByVal idioma As Integer, ByVal orden As String, ByVal comienzo As Integer, ByVal maximonumeroregistros As Integer, ByVal condicion As String) As DataSet

     Dim cnconexion As New SqlConnection(ConfigurationManager.ConnectionStrings("Cresolia").ConnectionString)

    Dim sqlc As New SqlCommand("seleccionar_obras", cnconexion)

    Dim da As SqlDataAdapter = New SqlDataAdapter(sqlc), ds As DataSet = New DataSet()

            sqlc.CommandType =CommandType.StoredProcedure

               sqlc.Parameters.AddWithValue("@obra", obra)

               sqlc.Parameters.AddWithValue("@idioma", idioma)

              sqlc.Parameters.AddWithValue("@orden", orden)

               sqlc.Parameters.AddWithValue("@comienzo", comienzo)

                sqlc.Parameters.AddWithValue("@maximonumeroregistros", maximonumeroregistros)

                sqlc.Parameters.AddWithValue("@condicion", condicion)

                cnconexion.Open()

                da.Fill(ds)

               cnconexion.Close()

    Return ds

    End Function

     Public Function seleccionar_numero(ByVal obra As Integer, ByVal idioma As Integer, ByVal condicion As String) As Integer

     Dim cnconexion As New SqlConnection(ConfigurationManager.ConnectionStrings("Cresolia").ConnectionString)

    Dim sqlc As New SqlCommand("seleccionar_numeroregistros_obras", cnconexion)

    Dim intnumeroregistros As Integer

               sqlc.CommandType =CommandType.StoredProcedure

                sqlc.Parameters.AddWithValue("@obra", obra)

                sqlc.Parameters.AddWithValue("@idioma", idioma)

                sqlc.Parameters.AddWithValue("@condicion", condicion)

                cnconexion.Open()

                intnumeroregistros =CInt(sqlc.ExecuteScalar())

                cnconexion.Close()

    Return intnumeroregistros

    End Function

    But I get this error

    ObjectDataSource 'objdsobras' no pudo encontrar un método 'seleccionar_cuenta' no genérico que tenga parámetros: condicion, obra, idioma

    It tells that there is no a typename with the only 3 given parameters.

    why?

    Thanks in advance

       

    End Class

      

    </asp:ObjectDataSource>

     

    Sunday, March 3, 2013 2:35 PM

Answers