« May 2005 | Main | July 2005 »

June 30, 2005

ADO.NET Gotch #2 - What's really bothering you?

For some reason, when you do a database operation and it fails.  For example, the following:

myAdapter.Fill(ds.MyTable)

Might fail with a generic OleDBException or SqlException:

Dataerror

Which doesn't tell you anything.  To get the real information, you need to wrap the call in a try...catch and look at the exception message, which for some reason, is much more descriptive but not displayed by default:

Try
    myAdapter.Fill(ds.MyTable)
Catch ex as Exception
    Throw New ApplicationException(ex.Message, ex)
End Try

Which gives

Dataerrormore

Posted on June 30, 2005 at 03:22 PM | Permalink | Comments (1)

June 29, 2005

What the hell is this?

www.use.com: Users Search Engine

Seems like a strange time for a brand new search engine to emerge. Is this a hoax?

Posted on June 29, 2005 at 05:47 PM | Permalink | Comments (2)

VB.NET GetType throws an exception?

Working with some colleagues today, we came across a strange error (bug) if you use VB.NET GetType on a class decorated with ComImport.

This code:

Imports System.Runtime.InteropServices

Module Module1

    Sub Main()
        Dim t As Type = GetType(SomeClass)
    End Sub End Module <ComImport()> _
Public Class SomeClass End Class

Generates a TypeLoadException:

Gettypeerror

Nifty.  Thoughts?

Posted on June 29, 2005 at 04:07 PM | Permalink | Comments (2)

Microsoft News 2005.06.29 - It's a small world after all

Microsoft inks deal with the Indian state of Maharashtra.

Commenting on the partnership, Deshmukh said, "Our partnership with Microsoft compliments our government's unique focus and vision for creating a unique edge for the state of Maharashtra on the IT front. We believe that through technology, we can create a skilled resource base in our state comprising of the next generation of professionals both at the grass root level as well as in terms of high-end IT talent."

Elaborating on Microsoft's partnership with the Government of Maharashtra, Venkatesan, said, "India is synonymous with IT success today and is mirroring the new face of IT led development in emerging economies. As a long-term partner for India, at Microsoft we strive to be a key contributor to this success and at the same time help create a digitally-inclusive society where technology reaches out to the over one billion strong population especially the marginalised sections at the grass root level to realise their full potential. We seek to work closely with Indian governments for realisation of this vision."

Microsoft Partners With Japan Colleges

Microsoft is strengthening its partnership with Japanese universities to promote joint projects and exchange among researchers, the American software company said Tuesday.

An organization called the Microsoft Institute for Japanese Academic Research Collaboration is being set up July 1 to support exchanges between Microsoft's research unit and Japanese researchers to develop advanced technology for Japan and other global markets, it said in a statement.

China Amoi Electronics sets tie up with Microsoft on 3C products

Amoi Electronics Co Ltd (SHA 600057), a major electronics company in China, said it has signed a strategic cooperation agreement with Microsoft Corp to work on computing, communications and consumer electronics (3C) products.

Note to US workers, the world is becoming a meritocracy. The bottom line, if you're not the best value, you will not be first. The bariers that have prevented your job from being done elsewhere are either gone, or are going away. If you haven't read "The World is Flat", stop what you're doing right now and go buy it.

Posted on June 29, 2005 at 08:43 AM | Permalink | Comments (0)

June 28, 2005

Microsoft News 2005.06.28

Microsoft's answer to AJAX? Atlas.

One example of AJAX in action, the real-time VB.NET/C# code converter. Converts your code as you type.

Microsoft now has a Longhorn RSS Team blog.

And they're pimping a new Architecture Resource Center.

Posted on June 28, 2005 at 04:37 PM | Permalink | Comments (0)

June 18, 2005

ADO.NET 1.1 Gotch #1 - Sorted DataGrid, and correct row values

Assume you have a DataGrid bound to a DataTable. A common way to get data for the current grid row is to take the DataGrid.CurrentRowIndex, and use it to index into the DataTable:

Dim gridRowIndex As Integer = DataGrid1.CurrentRowIndex
Dim value As String = NorthwindDataSet1.Products(gridRowIndex).ProductName
MessageBox.Show(value)

However, this isn't the right way to get values for the current row. The problem is, if you click on column headings in the DataGrid, such that it sorts the rows, then this code will not work. Sorting doesn't actually change the rows in the underlying DataTable. The DataGrid actually binds to the DefaultView of the DataTable so that it can perform the sorting. So row 1 in the DataGrid is no longer row 1 in the DataTable.

There are a number of ways to get the correct row. One is to go through the currency manager to get the current row:

Dim columnName As String = NorthwindDataSet1.Products.ProductNameColumn.ColumnName
Dim row As DataRowView = _
BindingContext(DataGrid1.DataSource, DataGrid1.DataMember).Current
Dim value As String = row(columnName)
MessageBox.Show(value)

Another is to use the CurrentRowIndex from the DataGrid, but instead of looking up the row directly in the DataTable, you look up the row in the DefaultView of the DataTable
Dim columnName As String = NorthwindDataSet1.Products.ProductNameColumn.ColumnName
Dim gridRowIndex As Integer = DataGrid1.CurrentRowIndex
Dim value As String = NorthwindDataSet1.Products.DefaultView(gridRowIndex)(columnName)
MessageBox.Show(value)

Posted on June 18, 2005 at 10:31 AM | Permalink | Comments (1)

June 17, 2005

Microsoft News

Microsoft opens Executive Briefing Center in Hyderabad, India.

Microsoft sticks a fork in Mono. The company came clean after developers who'd cloned other elements of Windows under the Mono Project said they are turning their attention to Indigo, the web services communications platform, and the Avalon GUI. At the time, Microsoft suggested developers could hit a licensing snag as it has so-far not been approached to discuss licensing of Indigo or Avalon APIs.

Microsoft invites hackers in to "Blue Hat" for jam session.

Posted on June 17, 2005 at 09:16 AM | Permalink | Comments (1)

Microsoft News

Microsoft opens Executive Briefing Center in Hyderabad, India.

Microsoft sticks a fork in Mono. The company came clean after developers who'd cloned other elements of Windows under the Mono Project said they are turning their attention to Indigo, the web services communications platform, and the Avalon GUI. At the time, Microsoft suggested developers could hit a licensing snag as it has so-far not been approached to discuss licensing of Indigo or Avalon APIs.

Microsoft invites hackers in to "Blue Hat" for jam session.

Posted on June 17, 2005 at 09:12 AM | Permalink | Comments (0)

June 10, 2005

See William Shatner pimp the Vic-20

For under $300, you too could invest in this machine. (I know I did)

Retrovic

See William Shatner give the pitch over on Retro Junk.

Posted on June 10, 2005 at 11:20 PM | Permalink | Comments (0)

June 09, 2005

160GB drive for notebooks

Laptop hard drives are about to go 3d as Seagate releases the first laptop drive using perpendicular recording technology. 2.5 inches, 160GB.

There's no word yet on when 4th dimensional storage devices will be available.

Posted on June 9, 2005 at 03:24 PM | Permalink | Comments (0)