I've created a dataset from a query that returns a column from an
amalgamation of fields in the database.

e.g. SELECT [FirstName] & ' ' & [LastName] AS [FullName] FROM [tblPeople]

However, when I try to modify the value of this column ([FullName], in the
example), I get an error saying it's read only. I can edit the other
columns just fine, but I cannot modify this one.

Is there any way to make the dataset allow me to modify data in this column?
The dataset just contains throwaway data that I'm never going to write back
to the database anyway.

- Don

Re: Can't edit a field in a dataset by Nicole

Nicole
Tue Oct 28 16:42:04 CST 2003

Don,

If this is a typed dataset, the element for the column would have been
automatically marked as read-only if you created the dataset table by
dragging a saved query/view onto the dataset design surface. To fix this,
open the XSD file, select the FullName element in dataset view, and set its
ReadOnly property to false.

If this is not a typed dataset, you should not be seeing this problem. If
so, how are you creating and filling the dataset?

HTH,
Nicole


"Don" <unknown@oblivion.com> wrote in message
news:VRBnb.208347$pl3.160042@pd7tw3no...
> I've created a dataset from a query that returns a column from an
> amalgamation of fields in the database.
>
> e.g. SELECT [FirstName] & ' ' & [LastName] AS [FullName] FROM [tblPeople]
>
> However, when I try to modify the value of this column ([FullName], in the
> example), I get an error saying it's read only. I can edit the other
> columns just fine, but I cannot modify this one.
>
> Is there any way to make the dataset allow me to modify data in this
column?
> The dataset just contains throwaway data that I'm never going to write
back
> to the database anyway.
>
> - Don
>
>



Re: Can't edit a field in a dataset by Don

Don
Wed Oct 29 13:29:22 CST 2003

I'm not 100% sure what you mean by "typed dataset", and I don't know
anything about XSD files or dragging queries into dataset design surfaces.
Here is a mockup of the code I used to get the dataset:

----

Dim daTemp As OleDbDataAdapter
Dim dsResult As New DataSet
' mconMainDB is the connection to the database that is already open at this
point

' Build query
strSQL = "SELECT [FirstName],[LastName],[FirstName] & ' ' & [LastName] AS
[FullName] FROM [tblPeople];"

' Create data adapter
daTemp = New OleDbDataAdapter(strSQL, mconMainDB)

' Make sure data adapter gets primary key info when it fills the dataset
daTemp.MissingSchemaAction = MissingSchemaAction.AddWithKey

' Get dataset of appointments
daTemp.Fill(dsResult, strDataTableName)

' Clean up
daTemp.Dispose()

----

I'll be able to edit the [FirstName] and [LastName] columns, but not the
[FullName] column.


- Don




"Nicole Calinoiu" <nicolec@somewhere.net> wrote in message
news:##3XSTanDHA.2404@TK2MSFTNGP12.phx.gbl...
> Don,
>
> If this is a typed dataset, the element for the column would have been
> automatically marked as read-only if you created the dataset table by
> dragging a saved query/view onto the dataset design surface. To fix this,
> open the XSD file, select the FullName element in dataset view, and set
its
> ReadOnly property to false.
>
> If this is not a typed dataset, you should not be seeing this problem. If
> so, how are you creating and filling the dataset?
>
> HTH,
> Nicole
>
>
> "Don" <unknown@oblivion.com> wrote in message
> news:VRBnb.208347$pl3.160042@pd7tw3no...
> > I've created a dataset from a query that returns a column from an
> > amalgamation of fields in the database.
> >
> > e.g. SELECT [FirstName] & ' ' & [LastName] AS [FullName] FROM
[tblPeople]
> >
> > However, when I try to modify the value of this column ([FullName], in
the
> > example), I get an error saying it's read only. I can edit the other
> > columns just fine, but I cannot modify this one.
> >
> > Is there any way to make the dataset allow me to modify data in this
> column?
> > The dataset just contains throwaway data that I'm never going to write
> back
> > to the database anyway.
> >
> > - Don
> >
> >
>
>



Re: Can't edit a field in a dataset by William

William
Wed Oct 29 14:28:51 CST 2003

Sure. This is "by design". Computed expressions are, by default not
updatable.

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
MVP, hRD
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________

"Don" <unknown@oblivion.com> wrote in message
news:myUnb.217271$9l5.54046@pd7tw2no...
> I'm not 100% sure what you mean by "typed dataset", and I don't know
> anything about XSD files or dragging queries into dataset design surfaces.
> Here is a mockup of the code I used to get the dataset:
>
> ----
>
> Dim daTemp As OleDbDataAdapter
> Dim dsResult As New DataSet
> ' mconMainDB is the connection to the database that is already open at
this
> point
>
> ' Build query
> strSQL = "SELECT [FirstName],[LastName],[FirstName] & ' ' & [LastName] AS
> [FullName] FROM [tblPeople];"
>
> ' Create data adapter
> daTemp = New OleDbDataAdapter(strSQL, mconMainDB)
>
> ' Make sure data adapter gets primary key info when it fills the dataset
> daTemp.MissingSchemaAction = MissingSchemaAction.AddWithKey
>
> ' Get dataset of appointments
> daTemp.Fill(dsResult, strDataTableName)
>
> ' Clean up
> daTemp.Dispose()
>
> ----
>
> I'll be able to edit the [FirstName] and [LastName] columns, but not the
> [FullName] column.
>
>
> - Don
>
>
>
>
> "Nicole Calinoiu" <nicolec@somewhere.net> wrote in message
> news:##3XSTanDHA.2404@TK2MSFTNGP12.phx.gbl...
> > Don,
> >
> > If this is a typed dataset, the element for the column would have been
> > automatically marked as read-only if you created the dataset table by
> > dragging a saved query/view onto the dataset design surface. To fix
this,
> > open the XSD file, select the FullName element in dataset view, and set
> its
> > ReadOnly property to false.
> >
> > If this is not a typed dataset, you should not be seeing this problem.
If
> > so, how are you creating and filling the dataset?
> >
> > HTH,
> > Nicole
> >
> >
> > "Don" <unknown@oblivion.com> wrote in message
> > news:VRBnb.208347$pl3.160042@pd7tw3no...
> > > I've created a dataset from a query that returns a column from an
> > > amalgamation of fields in the database.
> > >
> > > e.g. SELECT [FirstName] & ' ' & [LastName] AS [FullName] FROM
> [tblPeople]
> > >
> > > However, when I try to modify the value of this column ([FullName], in
> the
> > > example), I get an error saying it's read only. I can edit the other
> > > columns just fine, but I cannot modify this one.
> > >
> > > Is there any way to make the dataset allow me to modify data in this
> > column?
> > > The dataset just contains throwaway data that I'm never going to write
> > back
> > > to the database anyway.
> > >
> > > - Don
> > >
> > >
> >
> >
>
>



Re: Can't edit a field in a dataset by Nicole

Nicole
Thu Oct 30 10:06:26 CST 2003

Don,

You are using MissingSchemaAction.AddWithKey, which causes the calculated
column to be marked as read-only. Using MissingSchemaAction.Add will avoid
this. However, it might cause some other problems if you are relying on
other information generated through the use of AddWithKey. If this is the
case, you might want to continue using AddWithKey and just mark the column
as writeable prior to the update. e.g. (immediately after filling the
table):

dsResult.Tables.Item(0).Columns.Item(2).ReadOnly = false

HTH,
Nicole



"Don" <unknown@oblivion.com> wrote in message
news:myUnb.217271$9l5.54046@pd7tw2no...
> I'm not 100% sure what you mean by "typed dataset", and I don't know
> anything about XSD files or dragging queries into dataset design surfaces.
> Here is a mockup of the code I used to get the dataset:
>
> ----
>
> Dim daTemp As OleDbDataAdapter
> Dim dsResult As New DataSet
> ' mconMainDB is the connection to the database that is already open at
this
> point
>
> ' Build query
> strSQL = "SELECT [FirstName],[LastName],[FirstName] & ' ' & [LastName] AS
> [FullName] FROM [tblPeople];"
>
> ' Create data adapter
> daTemp = New OleDbDataAdapter(strSQL, mconMainDB)
>
> ' Make sure data adapter gets primary key info when it fills the dataset
> daTemp.MissingSchemaAction = MissingSchemaAction.AddWithKey
>
> ' Get dataset of appointments
> daTemp.Fill(dsResult, strDataTableName)
>
> ' Clean up
> daTemp.Dispose()
>
> ----
>
> I'll be able to edit the [FirstName] and [LastName] columns, but not the
> [FullName] column.
>
>
> - Don
>
>
>
>
> "Nicole Calinoiu" <nicolec@somewhere.net> wrote in message
> news:##3XSTanDHA.2404@TK2MSFTNGP12.phx.gbl...
> > Don,
> >
> > If this is a typed dataset, the element for the column would have been
> > automatically marked as read-only if you created the dataset table by
> > dragging a saved query/view onto the dataset design surface. To fix
this,
> > open the XSD file, select the FullName element in dataset view, and set
> its
> > ReadOnly property to false.
> >
> > If this is not a typed dataset, you should not be seeing this problem.
If
> > so, how are you creating and filling the dataset?
> >
> > HTH,
> > Nicole
> >
> >
> > "Don" <unknown@oblivion.com> wrote in message
> > news:VRBnb.208347$pl3.160042@pd7tw3no...
> > > I've created a dataset from a query that returns a column from an
> > > amalgamation of fields in the database.
> > >
> > > e.g. SELECT [FirstName] & ' ' & [LastName] AS [FullName] FROM
> [tblPeople]
> > >
> > > However, when I try to modify the value of this column ([FullName], in
> the
> > > example), I get an error saying it's read only. I can edit the other
> > > columns just fine, but I cannot modify this one.
> > >
> > > Is there any way to make the dataset allow me to modify data in this
> > column?
> > > The dataset just contains throwaway data that I'm never going to write
> > back
> > > to the database anyway.
> > >
> > > - Don
> > >
> > >
> >
> >
>
>