There's a useful article here that does what you need in C# about integrating backend database calls up to Virtual Earth:
http://blogs.msdn.com/mappoint_b2b/archive/2005/12/06/500751.aspx
I have been doing something similar with Oracle Spatial. What I ended up doing was passing in a Select with the appropriate where clause to select a rectangle and then included the convert to well known text function in the Select statement so instead of getting back a spatial object (ie geometry column), I got back a text string with all the coordinates of the polygons. In the .NET world, getstring returned the string with no problem (worked first try).
Brian
Yeah I did something similar in mySQL recently, stored as a 'geometry' data type and used it for seaching like that but then converted it back out as a string of values and then parsed that string to create the actual polygon in VE.
I actually encoded the values on the server and passed only the encoded string across to the client (as it is 25% of the size).
http://www.soulsolutions.com.au/Articles/Encodingforperformance/tabid/96/Default.aspx
John.
well,
if your used to asp.net 2.0 you could just use the clientcallback feature to get the needed data out of your db,
as csv string or xml,
i prefer csv format over xml,
then you could parse the string and create your polygon from the received data.
thats the way i actually do it.