467,076 Members | 904 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,076 developers. It's quick & easy.

prevent user from adding a new record to a datagrid/dataset

I have filled a datagrid with data from a dataset. The dataset was filled
with a dataadapter - and I used the wizard to create insert, update, delete
commands.

I would like to prevent the user from adding a new record in the datagrid,
but still be able to change/delete data - is this possible??

Maria
Nov 21 '05 #1
  • viewed: 1292
Share:
5 Replies
you need to associate the datatable you are looking at with a dataview. set
the dataview.allownew property to false. Then bind the dataview to datagrid

dim DV as new DataView
DV.Table = DataSet.Table(0) 'I think that's the right way to get the table
DV.AllowNew = False
DataGrid.DataSource = DV

Enjoy
Chris
"Maria Anthonsen" <ma*****@INGENSPAMstart.no> wrote in message
news:O1**************@TK2MSFTNGP12.phx.gbl...
I have filled a datagrid with data from a dataset. The dataset was filled
with a dataadapter - and I used the wizard to create insert, update, delete commands.

I would like to prevent the user from adding a new record in the datagrid,
but still be able to change/delete data - is this possible??

Maria

Nov 21 '05 #2
When doing your Query through the wizard, after building your query click on
the button "Advanced Options". Uncheck the box that says Generate Insert,
Update and Delete statements. This will prevent any of these functions to
be run against the dataset.

Hope this helps.

Brad
"Maria Anthonsen" <ma*****@INGENSPAMstart.no> wrote in message
news:O1**************@TK2MSFTNGP12.phx.gbl...
I have filled a datagrid with data from a dataset. The dataset was filled
with a dataadapter - and I used the wizard to create insert, update, delete
commands.

I would like to prevent the user from adding a new record in the datagrid,
but still be able to change/delete data - is this possible??

Maria

Nov 21 '05 #3
Brad,

In my opinion does not do as Maria asked, the + in the datagrid stays,
therefore is needed as Chris wrote or something as
\\\
ds.tables(0).defaultview.allownew = false
///
I hope that helps?

Cor

"Brad" <ba******@ukcdogs.com>
When doing your Query through the wizard, after building your query click
on the button "Advanced Options". Uncheck the box that says Generate
Insert, Update and Delete statements. This will prevent any of these
functions to be run against the dataset.

Hope this helps.

Brad
"Maria Anthonsen" <ma*****@INGENSPAMstart.no> wrote in message
news:O1**************@TK2MSFTNGP12.phx.gbl...
I have filled a datagrid with data from a dataset. The dataset was filled
with a dataadapter - and I used the wizard to create insert, update,
delete commands.

I would like to prevent the user from adding a new record in the
datagrid, but still be able to change/delete data - is this possible??

Maria


Nov 21 '05 #4
Thank you very much!!

hug
Maria

"Cor Ligthert" <no************@planet.nl> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Brad,

In my opinion does not do as Maria asked, the + in the datagrid stays,
therefore is needed as Chris wrote or something as
\\\
ds.tables(0).defaultview.allownew = false
///
I hope that helps?

Cor

"Brad" <ba******@ukcdogs.com>

Nov 21 '05 #5
Thanks Cor, I had wondered how to do the same concept for a multi-table
dataset. Thanks again for enlightenment.

Chris

"Cor Ligthert" <no************@planet.nl> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Brad,

In my opinion does not do as Maria asked, the + in the datagrid stays,
therefore is needed as Chris wrote or something as
\\\
ds.tables(0).defaultview.allownew = false
///
I hope that helps?

Cor

"Brad" <ba******@ukcdogs.com>
When doing your Query through the wizard, after building your query click
on the button "Advanced Options". Uncheck the box that says Generate
Insert, Update and Delete statements. This will prevent any of these
functions to be run against the dataset.

Hope this helps.

Brad
"Maria Anthonsen" <ma*****@INGENSPAMstart.no> wrote in message
news:O1**************@TK2MSFTNGP12.phx.gbl...
I have filled a datagrid with data from a dataset. The dataset was
filled with a dataadapter - and I used the wizard to create insert,
update, delete commands.

I would like to prevent the user from adding a new record in the
datagrid, but still be able to change/delete data - is this possible??

Maria



Nov 21 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Clayton Hamilton | last post: by
1 post views Thread by Brian | last post: by
2 posts views Thread by Tor Inge Rislaa | last post: by
12 posts views Thread by Aaron Smith | last post: by
5 posts views Thread by Sharon | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.