Re: VS2008: How to access properties of a table in O/R designer

  • From: "Varun Khosla" <varun.lists@xxxxxxxxx>
  • To: programmingblind@xxxxxxxxxxxxx
  • Date: Wed, 11 Jun 2008 10:17:58 +0530

Hi Ricks,
In linq when we query the database like this:
dim resultRow = (from tableVar in dataContext.TableName where
tableVar.key = matchingKeyVar select tableVar).take(1).single()

the resultRow variable is filled up with first row resulting from the
where condition. Now suppose the queried table has 15 columns, and we
want to update the value of column5&6, we can do that like this:
resultRow.column5 = "some value"
resultRow.column6 = "some another value"
And call submit changes like this:
dataContext.SubmitChanges()
It will update those two columns. since resultRow contained values of
all the 15 columns, we don't need to specify the value of each but
only those which we want to update.
But if you had specified a select statement in the linq query like this:
dim resultRow = (from tableVar in dataContext.TableName where
tableVar.key = matchingKeyVar select tableVar.column5,
tableVar.column6).take(1).single()
This query will result in only two columns being members of resultRow,
but as I have seen, these columns are read-only and you cannot change
their value.

HTH

On 6/8/08, Ricks Place <OFBGMail@xxxxxxxxx> wrote:
> Hi Guys:
> Along these lines:
> When I use a DataTable, DataSet, I get Rows on any select. I can limit the
> data returned to a couple of columns but it seems I have to provide values
> for an entire row or the values are messed up during an update. I don't
> think I can just set and update a couple of columns using the DataSet Update
> function. Is this the case with Linq? Can you just Select a couple of
> columns, set them and then apply an update for them or will that tip other
> columns in the original row?
> I hope I explained this well enough to understand and my understanding is
> correct. I had problems like this some time ago so always just read entire
> rows, update whatever columns I want then ReWrite the entire row. This is,
> of course, pretty inefficient and I even had to write a TableAdapter
> extension to avoid Optimistic Concurrency for a particular update since it
> was so blasted slow and unnessisary for the particular update.
> Anyway, while on the Linq topic I thought I would ask in case someone has
> had experience with this situation.
> Rick Farmington Mich. USA
> If you knowal Message -----
> From: "Varun Khosla" <varun.lists@xxxxxxxxx>
> To: <programmingblind@xxxxxxxxxxxxx>
> Sent: Sunday, June 08, 2008 3:10 AM
> Subject: Re: VS2008: How to access properties of a table in O/R designer
>
>
>> By the way, I've found an alternative for this. Locate the table in
>> the designer window, press shortcut key, open add sub-menu, click
>> property - it will take you to the list of the columns for that table
>> focussing an edit box forcing you to specify a name for the new
>> property. Pressing the shift+tab creates a new property with the
>> default name property1, since it's not required one can delete it by
>> selecting it in the listbox and pressing the dell key.
>>
>> I know that this is not the right way to go about it, but this is the
>> only way I'm able to know to go about it. (smile)
>>
>>
>> On 6/7/08, Varun Khosla <varun.lists@xxxxxxxxx> wrote:
>>> P.P.S. is additional postscript
>>>
>>> On 6/1/08, Chris Hallsworth <christopherhallsworth71@xxxxxxxxxxxxxx>
>>> wrote:
>>>> Hi what's PPS? I've heard of PS but not PPS? Thanks and sorry for my
>>>> ignorance.
>>>> --
>>>> Chris Hallsworth
>>>>   ----- Original Message -----
>>>>   From: Varun Khosla
>>>>   To: programmingblind@xxxxxxxxxxxxx
>>>>   Sent: Monday, June 02, 2008 8:13 AM
>>>>   Subject: VS2008: How to access properties of a table in O/R designer
>>>>
>>>>
>>>>   Hello listers,
>>>>   Has anybody worked on VS2008? It has new feature called LINQ
>>>> (Language-Integrated Query) designed to further increased the
>>>> speed/object
>>>> orientation of working with database. It has added an O/R designer for
>>>> this
>>>> purpose. User can drag-drop tables from server explorer to the designer
>>>> to
>>>> create a data context which is the focle point of LINQ.
>>>> Dragging/dropping
>>>> part is okay because Jaws has a shortcut key for this purpose. The
>>>> problem
>>>> I'm facing is how to access properties of the table object (don't
>>>> confuse
>>>> properties here with the general properties of any components such as
>>>> Name
>>>> which can be accessed via f4 in O/R as well, but with the properties
>>>> here
>>>> I
>>>> mean by columns of a table) so that I can delete specific columns that I
>>>> don't require (only from the table class of O/R designer and not from
>>>> the
>>>> database).
>>>>
>>>>   Has anybody gotten an idea as to how it can be done?
>>>>
>>>>   P.S. I've not been able to find a shortcut key for this anywhere on
>>>> the
>>>> net.
>>>>   P.P.S. Sighted folks can access it with the mouse, but there's no text
>>>> written at that point to make jaws cursor do the job.
>>>>
>>>>   Thanks
>>>>
>>>>   --
>>>>   Varun
>>>
>>>
>>> --
>>> Varun
>>>
>>
>>
>> --
>> Varun
>> __________
>> View the list's information and change your settings at
>> //www.freelists.org/list/programmingblind
>>
>
> __________
> View the list's information and change your settings at
> //www.freelists.org/list/programmingblind
>
>


-- 
Varun
__________
View the list's information and change your settings at 
//www.freelists.org/list/programmingblind

Other related posts: