Thursday, April 28, 2011

21 April 2011 -- My Daily Logs

1.The data source does not support server-side data paging.
Data Reader is forward only You cannot use datareader with Paging controls
for better performance fecth the result using datareader and load in datatable
2.How to fill DataTable with datareader
DataTable table = new DataTable(); // Retrieve a data reader, based on the Customers data. In // an application, this data might be coming from a middle-tier // business object: DataTableReader reader = new DataTableReader(GetCustomers());
table.Load(reader);
3. To get Selected row data of grid view
To determine the index of the row that raised the event, use the CommandArgument property of the event argument that is passed to the event. The ButtonField class automatically populates the CommandArgument property with the appropriate index value. For other command buttons, you must manually set the Command Argument property of the command button. For example, you can set the CommandArgument to <%# Container.DataItemIndex %>when the GridView control has no paging enabled.
4.ExecuteReader: CommandText property has not been initialized
Failed to given Store procedure name in the place
SqlCommand cm5 = new SqlCommand("", conn1);
5. To reduce the size of items in gridview.
Font-Size="8pt" Font-Names="Arial" GridLines="Vertical" CellPadding="4"
6.To Get the details of Table in sql server (like data type, Table type,creation date)
use short cut (alt+f1) i used this in sql server 2005
7. To add serial number for grid view.How to create a column that will autogenerate the serial number of each row
<%# ((GridViewRow)Container).RowIndex + 1%>
8. Font = georgia used this for grid view More Look like good and design.....
9.To add textbox in the grid view..........
Rs.
10.To make calculations in gridview field.................
11.temporary table in stored procedure
create table #temptable(var char(10))
# - it defines this table as temprorary and visible in the cureent session.
12. To set multiple values in switch case in SQL server
SELECT CASE @Status WHEN 1 THEN 'Active' WHEN 2 THEN 'Inactive' WHEN 3 THEN 'Pending' END case returns one value at a time.........
13.A SELECT statement that assigns a value to a variable must not be combined with data-retrieval operations.

No comments:

Post a Comment