473,419 Members | 1,577 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,419 software developers and data experts.

Updating table with no key field

hi,
I have a database table without a key field. I managed to view the contents
of the table through a DataSet in a DataGrid in C#. The user can edit the
data in the grid.
Can someone show me how to update the sourse database? I cannot use a
standard 'WHERE' claus simply because there is no key field in the source
table.
Nov 17 '05 #1
8 1368
Zest4Csharp wrote:
hi,
I have a database table without a key field. I managed to view the contents
of the table through a DataSet in a DataGrid in C#. The user can edit the
data in the grid.
Can someone show me how to update the sourse database? I cannot use a
standard 'WHERE' claus simply because there is no key field in the source
table.

You must then define what it is you are going to treat as UNIQUE to
treat as a pseudo key.
Or you could create a PK on the table.

JB
Nov 17 '05 #2
Thnaks John,
create PK on the source table you mean? Or the table now in the DataSet?
--

"John B" wrote:
Zest4Csharp wrote:
hi,
I have a database table without a key field. I managed to view the contents
of the table through a DataSet in a DataGrid in C#. The user can edit the
data in the grid.
Can someone show me how to update the sourse database? I cannot use a
standard 'WHERE' claus simply because there is no key field in the source
table.

You must then define what it is you are going to treat as UNIQUE to
treat as a pseudo key.
Or you could create a PK on the table.

JB

Nov 17 '05 #3
Zest4Csharp wrote:
Thnaks John,
create PK on the source table you mean? Or the table now in the DataSet?

On the source table.
If its MSSQL Server then you could use an IDENTITY column.

JB
Nov 17 '05 #4
john,
I cannot add a column as this will break other applications. However, i have
realised that i can use the 'hidden' column ROWID in Oracle from which i am
queryuing the data. Does SQL Server has such a unique row identifier that is
normally hidden from the user?
Cheers

=======
"John B" wrote:

Zest4Csharp wrote:
Thnaks John,
create PK on the source table you mean? Or the table now in the DataSet?

On the source table.
If its MSSQL Server then you could use an IDENTITY column.

JB

Nov 17 '05 #5
Zest4Csharp wrote:
john,
I cannot add a column as this will break other applications. Why will it break other apps? However, i have
realised that i can use the 'hidden' column ROWID in Oracle from which i am
queryuing the data. Does SQL Server has such a unique row identifier that is
normally hidden from the user? Not to the best of my knowledge.
One of the SQL Server groups might be able to give you more information.

JB
Cheers

=======
"John B" wrote:
Zest4Csharp wrote:
Thnaks John,
create PK on the source table you mean? Or the table now in the DataSet?


On the source table.
If its MSSQL Server then you could use an IDENTITY column.

JB

Nov 17 '05 #6
"=?Utf-8?B?WmVzdDRDc2hhcnA=?=" <Ze*********@discussions.microsoft.com>
wrote in news:41**********************************@microsof t.com:
Can someone show me how to update the sourse database? I cannot use a
standard 'WHERE' claus simply because there is no key field in the
source table.


You need to return the key field so you can use it to update, or other set of uniquely identifying
fields and use those.
--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programming is an art form that fights back"

Empower ASP.NET with IntraWeb
http://www.atozed.com/IntraWeb/
Nov 17 '05 #7
"=?Utf-8?B?WmVzdDRDc2hhcnA=?=" <Ze*********@discussions.microsoft.com>
wrote in news:00**********************************@microsof t.com:
I cannot add a column as this will break other applications. However,
Then you need to find some other unique identifier in the data you have. Why would adding a column
break your other apps? Are they blindly dispalying all columsn sent to them instead of a set
formatting?
i have realised that i can use the 'hidden' column ROWID in Oracle
Using ROWID is a very bad idea. Very very bad idea. RowID's can change even between SQL
statements.
from which i am queryuing the data. Does SQL Server has such a unique
row identifier that is normally hidden from the user?


I dont think so. Those that posted use identity, thats something totally different thatn RowID and not
what you are looking for.

--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programming is an art form that fights back"

Get your ASP.NET in gear with IntraWeb!
http://www.atozed.com/IntraWeb/
Nov 17 '05 #8
Zest4Csharp wrote:
hi,
I have a database table without a key field. I managed to view the contents
of the table through a DataSet in a DataGrid in C#. The user can edit the
data in the grid.
Can someone show me how to update the sourse database? I cannot use a
standard 'WHERE' claus simply because there is no key field in the source
table.

One other thing you might consider would be working out which
combinations of fields are "supposed" to be unique then defining either
a pk or a unique constraint on these fields.
If there are duplicates (as I have found in the past when faced with
this dilemna), you can temporarily add an identity int column wich SQL
server will automagically fill in for you and then remove the duplicates
(using your identity column) and then drop this column.

HTH
JB
Nov 17 '05 #9

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

Similar topics

11
by: Jason | last post by:
Let's say I have an html form with 20 or 30 fields in it. The form submits the fields via POST to a php page which updates a table in a database with the $_POST vars. Which makes more sense? ...
1
by: Srinadh | last post by:
Hi all, We have files with about 20 to 30 fields per row. We are trying to update such files with about 60 rows as contiguous data in a CLOB field. It passes through. But when we try...
6
by: Hasanain F. Esmail | last post by:
Hi all, I sincerly thank you all in advance for your help to solve this problem. I have been trying to find a solution to this problem for sometime now but have failed. I am working on a...
2
by: Ray Holtz | last post by:
I have a form that shows a single record based on a query criteria. When I click a button it is set to use an append query to copy that record to a separate table, then deletes the record from the...
5
by: junglist | last post by:
Hi guys, I've been trying to implement an editable datagrid and i have been succesful up to the point where i can update my datagrid row by row. However what used to happen was that once i updated...
11
by: Eych | last post by:
I get a VB error when I try to update a table whose field I change with the following statement: dcUpdate.Dataset.Tables(0).Rows(0)("User Name") = Me.textbox1.Text if I change the field name...
4
by: Geoff | last post by:
Hi I'm hoping somebody can help me with the following problem that has occurred to me. Suppose I have two tables in an SQL Server database. Let's call these tables A and B. Assume that A has...
33
by: bill | last post by:
In an application I am writing the user can define a series of steps to be followed. I save them in a sql database using the field "order" (a smallint) as the primary key. (there are in the range...
2
by: =?Utf-8?B?VmFuZXNzYQ==?= | last post by:
Hi All! I am with a situation where I am not getting the right updating to the form's fields. The situation is the following one: I have one combobox and one textbox. I am using the...
0
by: Mike | last post by:
So here's the situation (.NET 2.0 btw): I have a form, and on this form is a textbox among many other databound controls. The textbox is bound to a field in a data table via the Text property. ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...
1
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...
0
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...
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...

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.