Groups > Asp .Net > ASP.NET Tips and tricks > Re: FIX - DataSet Error "Could not find a non generic method"




Re: FIX - DataSet Error "Could not find a non generic
method"

Re: FIX - DataSet Error "Could not find a non generic method"
Tue, 25 Dec 2007 11:40:24 +000
Hi Amensi, I have same problem with ObjectDataSource. I tried as u suggested but
it didn't work. Pls suggest me solution...  

 

Public Function getNews() As DataTable
        Dim cmd As New OracleCommand("", con)
        cmd.CommandText = "SELECT HEADLINE, PREVIEW_IMAGE, SHOW_PREVIEW,
SHORT_DESC, DETAIL_NEWS, NEWS_DATE,Attachment,USER_ID, TIMESTAMP,ROWID AS
ROWID1,disp_order FROM NEWS_LINK"Dim ds As New DataSet
        Dim da As New OracleDataAdapter(cmd)
        da.Fill(ds, "NEWS_LINK")
        Return ds.Tables(0)
    End Function

    Public Function insertData(ByVal HEADLINE As String, ByVal PREVIEW_IMAGE As
String, ByVal SHOW_PREVIEW As Integer, ByVal SHORT_DESC As String, ByVal
DETAIL_NEWS As String, ByVal NEWS_DATE As String, ByVal ATTACHMENT As String) As
Boolean
        Dim cmd As New OracleCommand("", con)
        cmd.CommandText = "INSERT INTO NEWS_LINK (HEADLINE, PREVIEW_IMAGE,
SHOW_PREVIEW, SHORT_DESC, DETAIL_NEWS, NEWS_DATE, USER_ID, TIMESTAMP, LOCATION,
ATTACHMENT) VALUES('" & HEADLINE & "','" &
PREVIEW_IMAGE & "'," & SHOW_PREVIEW & ",'" &
SHORT_DESC & "','" & DETAIL_NEWS & "','" &
NEWS_DATE & "','" & Session("EMPID") &
"',SYSDATE,'None','" & ATTACHMENT & "')"
        Try
            If con.State = ConnectionState.Open Then
            Else
                con.Open()
            End If
            cmd.ExecuteNonQuery()
            Return True
        Catch ex As Exception

        End Try
    End Function

    Public Function updateData(ByVal ROWID1 As String, ByVal HEADLINE As String,
ByVal PREVIEW_IMAGE As String, ByVal SHOW_PREVIEW As Integer, ByVal SHORT_DESC
As String, ByVal DETAIL_NEWS As String, ByVal NEWS_DATE As String, ByVal
ATTACHMENT As String) As Boolean
        Dim cmd As New OracleCommand("", con)
        cmd.CommandText = "UPDATE NEWS_LINK SET HEADLINE='" &
HEADLINE & "',PREVIEW_IMAGE='" & PREVIEW_IMAGE &
"',SHOW_PREVIEW=" & SHOW_PREVIEW & ",SHORT_DESC='"
& SHORT_DESC & "',DETAIL_NEWS='" & DETAIL_NEWS &
"',NEWS_DATE='" & NEWS_DATE & "',USER_ID='" &
Session("EMPID") &
"',TIMESTAMP=SYSDATE,LOCATION='None',ATTACHMENT='" & ATTACHMENT
& "' WHERE ROWID='" & ROWID1 & "')"
Try
            If con.State = ConnectionState.Open Then
            Else
                con.Open()
            End If
            cmd.ExecuteNonQuery()
            Return True
        Catch ex As Exception

        End Try
    End Function


    Public Function deleteData(ByVal ROWID1 As String) As Boolean
        Dim cmd As New OracleCommand("", con)
        cmd.CommandText = "DELETE NEWS_LINK WHERE ROWID='" &
ROWID1 & "')"
        Try
            If con.State = ConnectionState.Open Then
            Else
                con.Open()
            End If
            cmd.ExecuteNonQuery()
            Return True
        Catch ex As Exception

        End Try
    End Function


'=======End functions================


         <asp:ObjectDataSource ID="ObjectDataSource1"
runat="server" DeleteMethod="deleteData"
            InsertMethod="insertData" SelectMethod="getNews"
TypeName="TBL_News_Link" UpdateMethod="updateData"
OldValuesParameterFormatString="Original_">
            <DeleteParameters>
                <asp:Parameter Name="ROWID1"
Type="String" />
            </DeleteParameters>
            <UpdateParameters>
                <asp:Parameter Name="ROWID1"
Type="String" />
                <asp:Parameter Name="HEADLINE"
Type="String" />
                <asp:Parameter Name="PREVIEW_IMAGE"
Type="String" />
                <asp:Parameter Name="SHOW_PREVIEW"
Type="Int32" />
                <asp:Parameter Name="SHORT_DESC"
Type="String" />
                <asp:Parameter Name="DETAIL_NEWS"
Type="String" />
                <asp:Parameter Name="NEWS_DATE"
Type="String" />
                <asp:Parameter Name="ATTACHMENT"
Type="String" />
            </UpdateParameters>
            <InsertParameters>
                <asp:Parameter Name="HEADLINE"
Type="String" />
                <asp:Parameter Name="PREVIEW_IMAGE"
Type="String" />
                <asp:Parameter Name="SHOW_PREVIEW"
Type="Int32" />
                <asp:Parameter Name="SHORT_DESC"
Type="String" />
                <asp:Parameter Name="DETAIL_NEWS"
Type="String" />
                <asp:Parameter Name="NEWS_DATE"
Type="String" />
                <asp:Parameter Name="ATTACHMENT"
Type="String" />
            </InsertParameters>
        </asp:ObjectDataSource>


'===============End ObjectDataSource============================


        <asp:GridView ID="GridView1" runat="server"
BackColor="White" BorderColor="#E7E7FF"
            BorderStyle="None" BorderWidth="1px"
CellPadding="3" DataSourceID="ObjectDataSource1"
DataKeyNames="ROWID1" AutoGenerateColumns="False">
            <FooterStyle BackColor="#B5C7DE"
ForeColor="#4A3C8C" />
            <Columns>
                <asp:TemplateField HeaderText="Disp_Order">
                    <EditItemTemplate>
                        <asp:TextBox ID="TextBox1"
runat="server" Text='<%# Bind("DISP_ORDER")
%>'></asp:TextBox>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label1"
runat="server" Text='<%# Bind("DISP_ORDER")
%>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="HEADLINE">
                    <EditItemTemplate>
                        <asp:TextBox ID="TextBox2"
runat="server" Text='<%# Bind("HEADLINE")
%>'></asp:TextBox>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label2"
runat="server" Text='<%# Bind("HEADLINE")
%>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="PREVIEW_IMAGE">
                    <EditItemTemplate>
                        <asp:FileUpload ID="FileUpload1"
runat="server" Width="168px" />
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label3"
runat="server" Text='<%# Bind("PREVIEW_IMAGE")
%>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="SHOW_PREVIEW">
                    <EditItemTemplate>
                        <asp:CheckBox ID="CheckBox1"
runat="server" Checked='<%# Bind("SHOW_PREVIEW") %>'
/>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label4"
runat="server" Text='<%# Bind("SHOW_PREVIEW")
%>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="SHORT_DESC">
                    <EditItemTemplate>
                        <asp:TextBox ID="TextBox3"
runat="server" Text='<%# Bind("SHORT_DESC") %>'
Width="208px"></asp:TextBox>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label5"
runat="server" Text='<%# Bind("SHORT_DESC")
%>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="DETAIL_NEWS">
                    <EditItemTemplate>
                        <asp:TextBox ID="TextBox4"
runat="server" Height="104px" Text='<%#
Bind("DETAIL_NEWS") %>'
                            TextMode="MultiLine"
Width="224px"></asp:TextBox>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:TextBox ID="TextBox4"
runat="server" Height="104px" Text='<%#
Bind("DETAIL_NEWS") %>'
                            TextMode="MultiLine"
Width="224px"></asp:TextBox>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="NEWS_DATE">
                    <EditItemTemplate>
                        <asp:TextBox ID="TextBox5"
runat="server" Text='<%# Bind("NEWS_DATE") %>'
Width="96px"></asp:TextBox>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label6"
runat="server" Text='<%# Bind("NEWS_DATE")
%>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Attachment">
                    <EditItemTemplate>
                        <asp:FileUpload ID="FileUpload2"
runat="server" Width="192px" />
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label7"
runat="server" Text='<%# Bind("ATTACHMENT")
%>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="ROWID">
                    <EditItemTemplate>
                        <asp:Label ID="Label9"
runat="server" Text='<%# Bind("ROWID1")
%>'></asp:Label>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label8"
runat="server" Text='<%# Bind("ROWID1")
%>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:CommandField ShowDeleteButton="True"
ShowEditButton="True" />
            </Columns>
            <RowStyle BackColor="#E7E7FF"
ForeColor="#4A3C8C" />
            <SelectedRowStyle BackColor="#738A9C"
Font-Bold="True" ForeColor="#F7F7F7" />
            <PagerStyle BackColor="#E7E7FF"
ForeColor="#4A3C8C" HorizontalAlign="Right" />
            <HeaderStyle BackColor="#4A3C8C"
Font-Bold="True" ForeColor="#F7F7F7" />
            <AlternatingRowStyle BackColor="#F7F7F7" />
        </asp:GridView>

'====================================

 

Error Msg: Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more information
about the error and where it originated in the code. 

Exception Details: System.InvalidOperationException: ObjectDataSource
'ObjectDataSource1' could not find a non-generic method 'deleteData' that has
parameters: ROWID1, Original_ROWID1.

Source Error:

An unhandled exception was generated during the execution of the current web
request. Information regarding the origin and location of the exception can be
identified using the exception stack trace below.
Stack Trace:



[InvalidOperationException: ObjectDataSource 'ObjectDataSource1' could not find
a non-generic method 'deleteData' that has parameters: ROWID1,
Original_ROWID1.]
   System.Web.UI.WebControls.ObjectDataSourceView.GetResolvedMethodData(Type
type, String methodName, IDictionary allParameters, DataSourceOperation
operation) +1440
   System.Web.UI.WebControls.ObjectDataSourceView.ExecuteDelete(IDictionary
keys, IDictionary oldValues) +1338
   System.Web.UI.DataSourceView.Delete(IDictionary keys, IDictionary oldValues,
DataSourceViewOperationCallback callback) +176
   System.Web.UI.WebControls.GridView.HandleDelete(GridViewRow row, Int32
rowIndex) +914
   System.Web.UI.WebControls.GridView.HandleEvent(EventArgs e, Boolean
causesValidation, String validationGroup) +1067
   System.Web.UI.WebControls.GridView.RaisePostBackEvent(String eventArgument)
+214
  
System.Web.UI.WebControls.GridView.System.Web.UI.IPostBackEventHandler.RaisePost
BackEvent(String eventArgument) +31
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl,
String eventArgument) +32
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +244
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint,
Boolean includeStagesAfterAsyncPoint) +3838


 

Thanks..
Post Reply
about | contact