473,466 Members | 1,465 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Overwriting data in database

34 New Member
How can i overwrite data in database?
As in it only saves one set of data..
Jul 29 '08 #1
9 1169
Curtis Rutland
3,256 Recognized Expert Specialist
Use UPDATE statements. Or, DELETE, then INSERT.

Other than that, I'm not really sure what you are asking.
Jul 29 '08 #2
mirainc
34 New Member
Use UPDATE statements. Or, DELETE, then INSERT.

Other than that, I'm not really sure what you are asking.
Hey there..
What im asking is im trying to save only 1 set of data everytime..
When a user saves a new data, it will overwrite the previous saved data..
How can i achieve this..?
You suggested the UPDATE statement..can give me a sample on how to do this?
Jul 29 '08 #3
Curtis Rutland
3,256 Recognized Expert Specialist
So you will only have one row in a table at a time? Is that what you mean? Or do you want only one row per user? If you need to know how to use a DB in your .NET program, we have two articles about it in the Howtwos section.
Jul 29 '08 #4
mirainc
34 New Member
So you will only have one row in a table at a time? Is that what you mean? Or do you want only one row per user? If you need to know how to use a DB in your .NET program, we have two articles about it in the Howtwos section.
Yes only one row/record in the table. Because i want the record to overwrite the previous one each time.
Jul 29 '08 #5
Curtis Rutland
3,256 Recognized Expert Specialist
Yes only one row/record in the table. Because i want the record to overwrite the previous one each time.
Well, that's easy enough. When you are ready to write the new values, you could execute a DELETE statement to delete the row, and an INSERT statement to add a new one, or you could use an UPDATE statement to update all the columns in place.

http://bytes.com/forum/thread635615.html
http://bytes.com/forum/thread817960.html

Read both of these tutorials to find out how to do this. There are code samples.
Jul 29 '08 #6
mirainc
34 New Member
Well, that's easy enough. When you are ready to write the new values, you could execute a DELETE statement to delete the row, and an INSERT statement to add a new one, or you could use an UPDATE statement to update all the columns in place.

http://bytes.com/forum/thread635615.html
http://bytes.com/forum/thread817960.html

Read both of these tutorials to find out how to do this. There are code samples.
I tried it but keep getting error..
Is there any way that you could guide me through it..
Appreciate the help..
Jul 30 '08 #7
Curtis Rutland
3,256 Recognized Expert Specialist
I tried it but keep getting error..
Is there any way that you could guide me through it..
Appreciate the help..
I'm sorry, but the tutoriala are guides.

Post your relevant code, your error, and what line throws it.
Jul 30 '08 #8
mirainc
34 New Member
I'm sorry, but the tutoriala are guides.

Post your relevant code, your error, and what line throws it.
This is my update statement
UPDATE [CrucialDate] SET [AcadYr] = @AcadYr, [Semester] = @Semester, [RegDate] = @RegDate, [WithDate] = @WithDate, [ContactPerson] = @ContactPerson

Protected Sub SaveBtn_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles SaveBtn.Click

SqlDataSource1.Update()
End Sub
If i use this, there's null values..
Jul 30 '08 #9
Curtis Rutland
3,256 Recognized Expert Specialist
You obviously haven't read either of the tutorials.

Read them first, rework your code, and come back if you still have problems.
Jul 30 '08 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Ellixis | last post by:
Hello, How can I use fwrite() and fseek() in order to write data in the middle (or anywhere else) of a file without overwriting existing data ? People told me that I should load the file into...
1
by: chris kittell | last post by:
Hi All, on db2 v8.1 for linux 32 bit redhat 7.3, when installing fixpak6,it's overwriting the symbolic link that I defined for the install directory, and proceeding to fill up my root partition....
9
by: Robert | last post by:
Hi, Is it me or is the recv() function not erasing but only overwriting the last data it supplied? example: when i first send: "login robert test"
19
by: tweak | last post by:
I have been messing around with buffers, and I found it peculiar that the code below will run without a segmentation fault. As far as I know, overwriting the allocated space from a call to...
11
by: Steven Jones | last post by:
I have a C program that prints out two lines as follows: Line 1 Line 2 What I would like is for this program to sleep for one second, and then print out two more lines, overwriting the...
2
by: Siva1983 | last post by:
Hi, I am generating text files from the msaccess database. What i have to do is take data from the database and store that into a text file. I have done that using the macros. When i generate...
4
by: QntmPg | last post by:
Hi all, I have read through what I could find on previous questions regarding using the OpenArgs property, but I'm still not able to get my form to open correctly. I'm not sure exactly where the...
27
by: Jason | last post by:
Hi, I need to open an existing file, seek to a position at X number of bytes, and write out Y number of bytes overwriting any existing bytes, but no erasing any other data. Is this possible? ...
3
by: scn87 | last post by:
I am doing a PHP DOM application.On basis of query some huge datas are selected and they are stored in an xml file.After doing certain calculations on this data i need to remove the existing data and...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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,...
0
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...
0
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,...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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 ...

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.