Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Oracle Empty String Problem

Status
Not open for further replies.

SonicChen

Programmer
Feb 14, 2004
62
CN
i use adodataset to access oralce table "csn.test"
F1 F2
a 1
b 2
c 3
connection and dataset open is all ok.
i add the following code:
Code:
procedure TForm1.Button1Click(Sender: TObject);
begin
  ADODataSet1.Edit;
  ADODataSet1.FieldByName('F2').AsString := '';
  ADODataSet1.Post;
end;
and the error message like this "can't locate the record for refreshing, maybe it has been modified." showed when i click the button1 the second time.


way to gold shines more than gold
 
oracle transfer empty string field to null field automaticlly. so i think it's error reason.
but i don't know how to solve it.

way to gold shines more than gold
 
What are the key fields? If both F1 and F2 are the primary key, this is telling you that it can't find the correct record to update. You also cannot have null field values in the primary key.

If the F2 field is not in the primary key, try using a query to update it instead of editing the dataset. The SQL would look something like this:

update MyTable
set F2 = ''
where F1 = :F1
and F2 = :F2

You pass in the parameters for the current value of the F1 and F2 fields, execute the query, and the refresh the dataset that you're editing.

-Dell
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top