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. 3 1161
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
"Elliot" wrote:
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.
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?
"Peter Bromberg [C# MVP]" <pb*******@yahoo.NoSpamMaam.comwrote in message
news:E5**********************************@microsof t.com...
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
"Elliot" wrote:
>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.
solved
"Peter Bromberg [C# MVP]" <pb*******@yahoo.NoSpamMaam.comwrote in message
news:E5**********************************@microsof t.com...
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
"Elliot" wrote:
>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. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Bruce Stockwell |
last post by:
the setup:
Webservice/WinClient application/SQL server.
VS.Net (visual basic) winform wizard creates a simple form
with load cancel cancelall and datagrid bound to a simple
Dataset with one...
|
by: Frnak McKenney |
last post by:
I'm using an in-core DataSet as an image of my application's
'database' (a multi-table Access97 mdb file). Updates are made to
the DataTables within the DataSet via forms with bound TextBoxes,...
|
by: Niyazi |
last post by:
Hi,
I have not understand the problem. Before all the coding with few
application everything worked perfectly. Now I am developing Cheque Writing
application and when the cheque is clear the...
|
by: Zachary Hilbun |
last post by:
The below is some test code to help me learn how to update a dataset.
It is supposed to read the value of UserCounter and write it back.
The UserCounter is being read correctly as 0, is 1 when...
|
by: JIM.H. |
last post by:
Hello,
Can I send a dataset as a parameter into stored procedure and import data to
a table in the stored procedure?
Thanks,
Jim.
|
by: jay |
last post by:
I am using the dataset object to add a row to a sql server database in vb.net
code, as follows:
dim drow as DataRow
dim cmdBld as new SqlCommandBuilder(mySqlDataAdapter)
ds.tables(0).NewRow()...
|
by: Lars Netzel |
last post by:
A little background:
I use three Datagrids that are in a child parent relation.
I Use Negative Autoincrement on the the DataTables and that's workning nice.
My problem is when I Update these...
|
by: Graham Blandford |
last post by:
Hi all,
Would someone be able to tell me the most 'graceful' way of removing
unwanted rows from a dataset based on a condition prior to update? OR,
resetting the rows all to unchanged after they...
|
by: A_PK |
last post by:
I have problem databinding the DataGrid with DataView/DataSet after the
filter...
I create the following proceudre in order for user to filter as many as they
want, but the following code is only...
|
by: Al |
last post by:
I have this scenario:
1. XML file with schema and data is created from SQL Server tables. XML file
contains 6 tables, some of them have rows, some of them are empty.
2. XML file is given to the...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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...
|
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,...
|
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...
| |