asp.net - Stored procedure doesnt return any value -
i got simple problem got no idea problem :/ in gridview
using objectdatasource
custom paging in tutorial http://www.codedigest.com/articles/aspnet/180_custom_gridview_paging_with_objectdatasource_control_with_aspnet_20.aspx
here aspx markup:
<asp:objectdatasource id="objectdatasource2" runat="server" onselecting="objectdatasource2_selecting" enablepaging="true" selectcountmethod="getitemscount" selectmethod="binditems" startrowindexparametername="startrowindex" maximumrowsparametername="maximumrows" typename="esova.utilities.recordutilities" >
and method calling:
public static datatable binditems(int category,int search,int startrowindex,int maximumrows) { datatable table = new datatable(); using (sqlconnection connection = new sqlconnection()) { connectionutilities.openconnection(connection); sqltransaction transaction = connection.begintransaction(); try { sqlcommand command = new sqlcommand("getitems",connection,transaction); command.commandtype = commandtype.storedprocedure; command.parameters.add("@rowindex", sqldbtype.int, 4).value = startrowindex; command.parameters.add("@maxrows", sqldbtype.int, 4).value = maximumrows; sqldataadapter adapter = new sqldataadapter(command); adapter.fill(table); transaction.commit(); } catch { transaction.rollback(); } } return table; }
my stored procedure works fine , return in items table.
but when analyze code, got breakpoint on return , table variable without records. don't know problem.
update:
create proc [dbo].[getitems](@rowindex int,@maxrows int) declare @startrows int declare @endrow int set @startrows=(@rowindex+1) set @endrow=(@startrows+@maxrows) select * ( select id, name, filepath, descript, itemlanguage, filetypeid, row_number() on (order id)as row items)as numberesitems row between @startrows , @endrow
your connectionstring empty.
Comments
Post a Comment