Visual Basic Q&A

As a software engineer, I focus on .NET, especially asp.net, C#, WCF and so on, and I am also very interested in Search Engine Optimization.

Entries Tagged ‘row’

BUG: DataGrid Web Server control wraps when the ItemStyle Wrap property or the HeaderStyle Wrap property is set to false in Visual Basic .NET

Symptoms
When you set the HeaderStyle Wrap or the ItemStyle Wrap property to False, data is still wrapped in the columns of the DataGrid Web control.
Resolution
The wrap functionality occurs for each cell and not for each row of the DataGrid. Therefore, if you set the wrap functionality for all of the DataGrid, text wrapping functionality is not disabled for every row or column.

Error message when you use DataReader in Visual Basic .NET: “Invalid attempt to read from column ordinal”

Symptoms
When you use DataReader to read a row, if you try to access columns in that row, you receive an error message similar to the following:

System.InvalidOperationException: Invalid attempt to read from column ordinal ‘0′.With CommandBehavior.SequentialAccess, you may only read from column ordinal ‘2′ or greater.
Resolution
This problem occurs because you executed OleDbCommand or SqlCommand with the System.Data.CommandBehavior.SequentialAccess flag set but did not access the columns sequentially.