473,785 Members | 3,142 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Insert, Update, Delete through DataGrid

From what I can gather these commands are automatically
generated throught the OleDbDataAdapte r wizard when
working with a one table database and from the MSDN
documnetation the values shown on screen are only a
snapshot of the data stored in the datbase not the actual
data itself. I just can't figure out what code I need in
the click event of my corosponding command buttons to
perform these actions. I presume I need to open, write
and close the database but at this point I'm lost any
help is much appreciated.

Thanks G.N
Nov 20 '05 #1
7 7279
Hello Gary

basically...the se are the steps:

1. Fill Datatable using DataAdapter
2. Set DataTable as datasource for grid
3. User makes changes to various rows, maybe adds new row, deletes another,
etc
4. Use update method of DataAdapter to update changes to DataTable


--
Ibrahim Malluf
http://www.malluf.com
=============== =============== =============== =
MCS Data Services Code Generator
http://64.78.34.175/mcsnet/DSCG/Announcement.aspx
=============== =============== =============== =

"Garry Newman" <G.**********@h otmail.com> wrote in message
news:10******** *************** ******@phx.gbl. ..
From what I can gather these commands are automatically
generated throught the OleDbDataAdapte r wizard when
working with a one table database and from the MSDN
documnetation the values shown on screen are only a
snapshot of the data stored in the datbase not the actual
data itself. I just can't figure out what code I need in
the click event of my corosponding command buttons to
perform these actions. I presume I need to open, write
and close the database but at this point I'm lost any
help is much appreciated.

Thanks G.N

Nov 20 '05 #2
Garry if you set the 'read only' property of the DataDrid
to 'False' then you can use something like...

OleDbDataAdapte r1.Update(DataS et1)

from your command button to save any changes you've made
during run-time.

To delete a record you can simply highlight the record
and hit delete on your keyboard likewise to add a record
you can just tab on or mouse click in the last record in
your datagrid which will appear blank and marked with an
* but I don't know how to get this add and delete
function running from command buttons, but I'm sure one
of the experts here will point you in the right direction
when they read your post...

Regards Steve
Nov 20 '05 #3
Thanks Ibrahim

All these things steps you've highlighted work perfectly
well but all I want is a command button which deletes a
record and one that starts a new record (the typical
controls you would have on an Access form instead of
having to highlight the record and hit delete on keyboard
or click on blank row to activate new record

Thanks G.N
Nov 20 '05 #4
ok thanks Steve at least I can get my ammendments to save
now, but I'd really like 'Add' & 'Delete' buttons on my
form instead of having to do it manually...

Thanks GN
Nov 20 '05 #5
Cor
Hi Garry,

There are a lot of possibilities how to do what your ask.

This is an example of a delete with a button, but it depends how you did
other things if it will work for you. We don't see code of you, do you know.
But this works for me.

\\\
Private Sub btnDelete_Click (ByVal sender As System.Object, _
ByVal e As System.EventArg s) Handles btnDelelete.Cli ck
dataset1.Tables (0).Rows(datagr id1.CurrentRowI ndex).Delete()
End Sub
///

But basicly I think this is what you are looking for?

Cor
All these things steps you've highlighted work perfectly
well but all I want is a command button which deletes a
record and one that starts a new record (the typical
controls you would have on an Access form instead of
having to highlight the record and hit delete on keyboard
or click on blank row to activate new record

Thanks G.N

Nov 20 '05 #6
Thanks Cor

That worked fine...
Nov 20 '05 #7
Thanks Cor

That worked fine

G.N
Nov 20 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

16
17019
by: Philip Boonzaaier | last post by:
I want to be able to generate SQL statements that will go through a list of data, effectively row by row, enquire on the database if this exists in the selected table- If it exists, then the colums must be UPDATED, if not, they must be INSERTED. Logically then, I would like to SELECT * FROM <TABLE> WHERE ....<Values entered here>, and then IF FOUND UPDATE <TABLE> SET .... <Values entered here> ELSE INSERT INTO <TABLE> VALUES <Values...
16
3877
by: robert | last post by:
been ruminating on the question (mostly in a 390/v7 context) of whether, and if so when, a row update becomes an insert/delete. i assume that there is a threshold on the number of columns of the table, or perhaps bytes, being updated where the engine just decides, screw it, i'll just make a new one. surfed this group and google, but couldn't find anything. the context: we have some java folk who like to parametize/
0
1702
by: 4 | last post by:
Insert/Delete/Modify Statement Shortcuts??? Help!! I am working in C# and running an Oracle 9i server. I was just wonering if there is a shortcut way of updating my tables and not have to build special front end for it. What I would like to do is update the tables that I have pulled from the database in the data grid (in a form window), modify the tables, add users, information, then use a button to update the
0
2208
by: Christopher | last post by:
I AM GETTING A SYSTEM.DATA.SQLCLIENT.SQLEXCEPTION ERROR WHEN ATTEMPTING TO INSERT DATA INTO A SINGLE TABLE THROUGH A GRID //If this is due to a spelling error, i will //inflict a ritual beating upon myself !!!!!!!!!!!! TABLE SCRIPT
2
1744
by: Mark | last post by:
I have a repetitive task where I need to edit a table in SQL Server through a web page. Nothing fancy, just populate a datagrid and use the commands Insert/Update/Delete/Cancel. Is there a quick and dirty way to do this within 60 seconds? I don't care if I have to use those design-time connection and data adapter objects. Or maybe there's a 3rd party tool? Thanks, Mark
3
3451
by: Shapper | last post by:
Hello, I have created 3 functions to insert, update and delete an Access database record. The Insert and the Delete code are working fine. The update is not. I checked and my database has all the necessary records in it when testing it. I get the error "No value given for one or more required parameters." when I try to update the database. Can you tell me what am I doing wrong?
1
2553
by: Primillo | last post by:
'Full source 'Insert, delete and update don't work Public Class WebForm1 Inherits System.Web.UI.Page Protected WithEvents Button1 As System.Web.UI.WebControls.Button Protected WithEvents Button2 As System.Web.UI.WebControls.Button Protected WithEvents Button3 As System.Web.UI.WebControls.Button
4
9698
by: drakuu | last post by:
Hello there, I have DataGrid with some records and I would like to edit it right in the datagrid using the built in commands. I can't figure out a way to pass to the SQL query the record ID which I'm editing. SELECT: SelectCommand="SELECT ProviderID, AddressID, Address, Address2, City, State, County, Zip FROM ProviderAddress WHERE (ProviderID = @ProviderID)"
0
1240
by: debnath1981 | last post by:
Insert, Update, Delete through DataGrid
4
4865
by: =?Utf-8?B?UmljaA==?= | last post by:
On a form - I have a datagridview which is docked to the entire form. The datagridview allows users to Delete and/or Add Rows. On the Form_Load event I Fill the datagridview source table with a sql DataAdapter (da) da.SelectCommand.CommandText = "Select * from Servertbl1" da.Fill(ds, "tbl1") so far, so good. If I add a row to the datagridview I use the following sqlDataAdapter code to update the server table - which works OK when...
0
9645
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9480
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
10151
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10092
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
9950
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...
0
8973
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7499
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
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3647
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.