C
Cirene
Using Visual Studio I created a DataSet using the GUI (XSD file).
Trying to use a tiered methodology I called the functions from my BLL.
Namespace Zzz.BusinessLogicLayer
#Region "DAL Access"
Public Class States
Public Sub New()
End Sub
Public Shared Function GetAllStates() As DataTable
Using db As New dsStatesTableAdapters.statesTableAdapter
Return db.GetData()
End Using
End Function
Public Shared Sub InsertState(ByVal UsState As String, ByVal
UsStateAbbreviation As String)
Using db As New dsStatesTableAdapters.statesTableAdapter
db.Insert(UsState, UsStateAbbreviation)
End Using
End Sub
Public Shared Sub UpdateState(ByVal UsState As String, ByVal
UsStateAbbreviation As String, ByVal original_StateId As Long)
Using db As New dsStatesTableAdapters.statesTableAdapter
db.Update(UsState, UsStateAbbreviation, original_StateId)
End Using
End Sub
Public Shared Sub DeleteState(ByVal Original_StateId As Long)
Using db As New dsStatesTableAdapters.statesTableAdapter
db.Delete(Original_StateId)
End Using
End Sub
End Class
#End Region
End Namespace
I got the default Select, Update, and Delete working, but the Insert keeps
giving me this error...
ObjectDataSource 'ObjectDataSource1' could not find a non-generic method
'InsertState' that has parameters: UsState, UsStateAbbreviation, StateId.
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 'InsertState' that
has parameters: UsState, UsStateAbbreviation, StateId.
I'm using a DetailsView to insert the records. Here's the simple layout of
my form...
<asp:GridView ID="GridView1" runat="server" DataKeyNames="StateId"
DataSourceID="ObjectDataSource1">
<Columns>
<asp:CommandField ShowDeleteButton="True" ShowEditButton="True"
ShowSelectButton="True" />
</Columns>
</asp:GridView>
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server"
DeleteMethod="DeleteState" InsertMethod="InsertState"
OldValuesParameterFormatString="original_{0}"
SelectMethod="GetAllStates"
TypeName="Zzz.BusinessLogicLayer.States" UpdateMethod="UpdateState">
<DeleteParameters>
<asp
arameter Name="Original_StateId" Type="Int64" />
</DeleteParameters>
<UpdateParameters>
<asp
arameter Name="UsState" Type="String" />
<asp
arameter Name="UsStateAbbreviation" Type="String" />
<asp
arameter Name="original_StateId" Type="Int64" />
</UpdateParameters>
<InsertParameters>
<asp
arameter Name="UsState" Type="String" />
<asp
arameter Name="UsStateAbbreviation" Type="String" />
</InsertParameters>
</asp:ObjectDataSource>
<asp
etailsView ID="DetailsView1" runat="server" DataKeyNames="StateId"
DataSourceID="ObjectDataSource1" DefaultMode="Insert" Height="50px"
Width="125px">
<Fields>
<asp:CommandField ShowInsertButton="True" />
</Fields>
</asp
etailsView>
Any ideas what I'm doing wrong???
Thanks...
Trying to use a tiered methodology I called the functions from my BLL.
Namespace Zzz.BusinessLogicLayer
#Region "DAL Access"
Public Class States
Public Sub New()
End Sub
Public Shared Function GetAllStates() As DataTable
Using db As New dsStatesTableAdapters.statesTableAdapter
Return db.GetData()
End Using
End Function
Public Shared Sub InsertState(ByVal UsState As String, ByVal
UsStateAbbreviation As String)
Using db As New dsStatesTableAdapters.statesTableAdapter
db.Insert(UsState, UsStateAbbreviation)
End Using
End Sub
Public Shared Sub UpdateState(ByVal UsState As String, ByVal
UsStateAbbreviation As String, ByVal original_StateId As Long)
Using db As New dsStatesTableAdapters.statesTableAdapter
db.Update(UsState, UsStateAbbreviation, original_StateId)
End Using
End Sub
Public Shared Sub DeleteState(ByVal Original_StateId As Long)
Using db As New dsStatesTableAdapters.statesTableAdapter
db.Delete(Original_StateId)
End Using
End Sub
End Class
#End Region
End Namespace
I got the default Select, Update, and Delete working, but the Insert keeps
giving me this error...
ObjectDataSource 'ObjectDataSource1' could not find a non-generic method
'InsertState' that has parameters: UsState, UsStateAbbreviation, StateId.
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 'InsertState' that
has parameters: UsState, UsStateAbbreviation, StateId.
I'm using a DetailsView to insert the records. Here's the simple layout of
my form...
<asp:GridView ID="GridView1" runat="server" DataKeyNames="StateId"
DataSourceID="ObjectDataSource1">
<Columns>
<asp:CommandField ShowDeleteButton="True" ShowEditButton="True"
ShowSelectButton="True" />
</Columns>
</asp:GridView>
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server"
DeleteMethod="DeleteState" InsertMethod="InsertState"
OldValuesParameterFormatString="original_{0}"
SelectMethod="GetAllStates"
TypeName="Zzz.BusinessLogicLayer.States" UpdateMethod="UpdateState">
<DeleteParameters>
<asp
</DeleteParameters>
<UpdateParameters>
<asp
<asp
<asp
</UpdateParameters>
<InsertParameters>
<asp
<asp
</InsertParameters>
</asp:ObjectDataSource>
<asp
DataSourceID="ObjectDataSource1" DefaultMode="Insert" Height="50px"
Width="125px">
<Fields>
<asp:CommandField ShowInsertButton="True" />
</Fields>
</asp
Any ideas what I'm doing wrong???
Thanks...