Move your sql before the prepared statement.
Sql =" sql = "UPDATE tbl_content_admin_accounts SET CA_PASSWORD = ?
WHERE ROW_ID = ?";
pstmtname = conn.prepareStatement(sql);
pstmtname.setString(1, "123456");
pstmtname.setString(2, UserID);
pstmtname.executeQuery();
This will work for sure... BTB Remember this is strictly a struts
mailing list.
Best Regards
Vishnu NV
-----Original Message-----
From: Avlesh Singh [mailto:avlesh@(protected)]
Sent: Tuesday, December 08, 2009 9:10 AM
To: Struts Users Mailing List
Subject: Re: SQL ExcuteQuery
Use #executeUpdate instead.
Cheers
Avlesh
On Tue, Dec 8, 2009 at 11:37 AM, Nguyen Xuan Son <yamacom@(protected)>
wrote:
> sorry saini but i dont see any different from your answer
> thank you
>
> 2009/12/8 Sushim Saini <sushimsaini@(protected)>
>
> > hi Nguyen Xuan Son
> > use
> > pstmtname.executeQuery() instead of pstmtname.executeQuery();
> >
> > On Tue, Dec 8, 2009 at 11:29, Nguyen Xuan Son <yamacom@(protected)>
wrote:
> >
> > > dear all
> > > I've written
> > > Connection conn = null;
> > > PreparedStatement pstmtname = null;
> > > pstmtname = conn.prepareStatement(sql);
> > > sql = "UPDATE tbl_content_admin_accounts SET CA_PASSWORD = ?
WHERE
> > ROW_ID
> > > =
> > > " + UserID;
> > > pstmtname.setString(1, "123456");
> > > pstmtname.executeQuery();
> > >
> > > there is no error appear but nothing is changed in the database
> > > do you have any suggestion?
> > > thank you very much
> > >
> > > --
> > >
=======================================================================
> > > Ritsumeikan University, Asia JinZai Project
> > > Master of Information Science
> > > Nguyen Xuan Son
> > >
> > > Add : Japan, Shiga-Ken, Kusatsu-Shi, Kasayama 3choume 1-18
> > > ShiteiHaimu
> > > Rien, Room 103
> > > Tel/Fax : 81-(0)90-3976 2246
> > > Email : nr0003xx@(protected)
> > > Mobile : 81-(0)90-3976 2246 URL :
http://www.ritsumei.jp
> > >
=======================================================================
> > >
> >
> >
> >
> > --
> > --
> > Sushim Saini
> >
>
>
>
> --
>
=======================================================================
> Ritsumeikan University, Asia JinZai Project
> Master of Information Science
> Nguyen Xuan Son
>
> Add : Japan, Shiga-Ken, Kusatsu-Shi, Kasayama 3choume 1-18
> ShiteiHaimu
> Rien, Room 103
> Tel/Fax : 81-(0)90-3976 2246
> Email : nr0003xx@(protected)
> Mobile : 81-(0)90-3976 2246 URL : http://www.ritsumei.jp
>
=======================================================================
>
I dont see you make database connection like this for example.
conn = DriverManager.getConnection
("jdbc:mysql://your_host:3306/dbName","dbUser","dbPass");
On Tue, Dec 8, 2009 at 10:59 AM, Nguyen Xuan Son <yamacom@(protected):
> dear all
> I've written
> Connection conn = null;
> PreparedStatement pstmtname = null;
> pstmtname = conn.prepareStatement(sql);
> sql = "UPDATE tbl_content_admin_accounts SET CA_PASSWORD = ? WHERE ROW_ID
> =
> " + UserID;
> pstmtname.setString(1, "123456");
> pstmtname.executeQuery();
>
> there is no error appear but nothing is changed in the database
> do you have any suggestion?
> thank you very much
>
> --
> =======================================================================
> Ritsumeikan University, Asia JinZai Project
> Master of Information Science
> Nguyen Xuan Son
>
> Add : Japan, Shiga-Ken, Kusatsu-Shi, Kasayama 3choume 1-18
> ShiteiHaimu
> Rien, Room 103
> Tel/Fax : 81-(0)90-3976 2246
> Email : nr0003xx@(protected)
> Mobile : 81-(0)90-3976 2246 URL : http://www.ritsumei.jp
> =======================================================================
>
--
Saeed Iqbal
Independant Consultant
J2EE - Application Architect / Developer