473,610 Members | 2,096 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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
5 1503
you need to associate the datatable you are looking at with a dataview. set
the dataview.allown ew 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.DataSo urce = DV

Enjoy
Chris
"Maria Anthonsen" <ma*****@INGENS PAMstart.no> wrote in message
news:O1******** ******@TK2MSFTN GP12.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*****@INGENS PAMstart.no> wrote in message
news:O1******** ******@TK2MSFTN GP12.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).de faultview.allow new = false
///
I hope that helps?

Cor

"Brad" <ba******@ukcdo gs.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*****@INGENS PAMstart.no> wrote in message
news:O1******** ******@TK2MSFTN GP12.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******** ********@TK2MSF TNGP09.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).de faultview.allow new = false
///
I hope that helps?

Cor

"Brad" <ba******@ukcdo gs.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******** ********@TK2MSF TNGP09.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).de faultview.allow new = false
///
I hope that helps?

Cor

"Brad" <ba******@ukcdo gs.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*****@INGENS PAMstart.no> wrote in message
news:O1******** ******@TK2MSFTN GP12.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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2219
by: Chumley the Walrus | last post by:
IN my code behind .vb page for a delete records script (this also does a deletion confirmation with a javascript popup, this gets called on my front .aspx page with the datagrid), I'm not sure if he row.delete() in my Delete_Row sub is correct because when deleting a record from the dbase, it doesnot get deleted from the actual database, even tho on the datagrid it does show that the record is deleted: '''''''''''''
1
1743
by: Job Lot | last post by:
In a multi-user environment, how would I prevent users from adding Orders with identical OrderID. For instance I have following tables in my database Order ================== OrderID Identity field CustomerID OrderDate DeliveryAddress
2
3626
by: Clayton Hamilton | last post by:
I have a DataGrid on a webform bound to a Datasource and can successfully use <ItemTemplate> to create edit/update/cancel functionality for user maintenance of data. I use separate logic to delete a row. Everything works just fine. BUT I would like to add a button to (for example) the DataGrid header, which when pressed will add a new row to the datagrid. This should then allow the user to enter information into text boxes (in some...
6
4370
by: anoj | last post by:
Hi All i need to prevent multiple logins from the same user at the same time. what is the best way to do this . How can i detect if a user closes the browser window without logging out so tht his/her id can be removed from the global list maintained for the looged in users
1
2169
by: Brian | last post by:
Hello - Is there a way to prevent the user from creating a blank row at the bottom of a datagrid? I want a read only grid that allows the user to view data but not select specific cells or create a blank row, etc. Thanks, Brian
2
1412
by: Tor Inge Rislaa | last post by:
Prevent Adding new records in DataGrid Hi I have a DataGrid that I want to open for editing but the user should not be able to add new records. When I set the ReadOnly = False it is possible to edit but it is also able to add new records. How do I prevent that?
12
3735
by: Aaron Smith | last post by:
What is the best way to handle data in a multiple user environment? We have forms that will allow users to add edit and delete data from a table on SQL server. The data could be edited on multiple machines at the same time. How do you keep the dataset constantly updated with changes made to the data? I'm playing with just calling the fill method, but it seems pretty unstable at times. Especially when deleting records, they don't seem to...
4
2497
by: Rich | last post by:
I fill a dataset like this: dim da As New SqlDataAdapter, ds As New Dataset, conn As New SqlConnection .... da.Fill(ds, "tbl1") datagrid1.DataSource = ds datagrid1.DataMember = "tbl1" When the form containing datagrid1 displays, all the records are there. The dataAdapter, da, is based on a stored procedure which only returns a set
5
4428
by: Sharon | last post by:
I have a DataGrid on my Form, and I wish to disable any cell editing. For example; when the user clicks on a cell, the cell become editable by changing its color to gray and context menu is shown on muse right mouse click. I do not want the enable this cell context menu (I have my own context menu) and I do not want the cell to change it's color. I want that on any click - the entire row will be selected. There are some other cases where...
0
8097
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8594
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8238
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8411
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6071
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5526
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2545
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1692
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1410
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.