Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / December 2007

Tip: Looking for answers? Try searching our database.

Dataset update problem

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Elliot - 12 Dec 2007 16:45 GMT
OracleConnection conn = new OracleConnection(ConnectionString);
OracleCommand cmdProfile = new OracleCommand("select * from Profile where
profile id = '1'", conn);
OracleDataAdapter adpProfile = new OracleDataAdapter();
adpProfile.SelectCommand = cmdProfile;
DataSet dsProfile = new DataSet();
adpProfile.Fill(dsProfile, "ProfileTable");
DataRow selectedRow = dsProfile.Tables["ProfileTable"].Rows[0];
selectedRow["FName"] = Profile_FName.Text;
adpProfile.Update(dsProfile, "ProfileTable");

When executing the above statement, no error return, but nothing changed in
database. What's going on?

Any idea would be appreciated.
Peter Bromberg [C# MVP] - 12 Dec 2007 18:12 GMT
I see a couple of potential problems with your SQL Statement

select * from Profile where profile id = '1'"  :

1) profile id is two words. It should probably be profileid (1 word)
2) = '1' is a string. Most likely the profileId column is integer, so you
need to remove the single quotes.
3) You should really be using a parameterized query.
-- Peter
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
MetaFinder: http://www.blogmetafinder.com 

> OracleConnection conn = new OracleConnection(ConnectionString);
> OracleCommand cmdProfile = new OracleCommand("select * from Profile where
[quoted text clipped - 11 lines]
>
> Any idea would be appreciated.
Elliot - 13 Dec 2007 05:36 GMT
Thanks for your idea, Peter.
"profile id" is just a retyping mistake. In fact, it is "profileid" in both
the code and the database. And, its datatype is varchar(Because I added some
characters before it sometimes).
What is parameterized query?

> I see a couple of potential problems with your SQL Statement
>
[quoted text clipped - 25 lines]
>>
>> Any idea would be appreciated.
Elliot - 13 Dec 2007 11:08 GMT
solved

> I see a couple of potential problems with your SQL Statement
>
[quoted text clipped - 25 lines]
>>
>> Any idea would be appreciated.

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.