Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / April 2008

Tip: Looking for answers? Try searching our database.

question on swings i.e delete button

Thread view: 
smart - 18 Apr 2008 08:33 GMT
Hello, Good Morning every one i am new to work with swings i am facing
problem with delete button.

In an application i kept a button Delete . For delete button i have
taken ShowConfirmDialog i.e YES_NO_OPTION.

When i press YES it is deleting record which is correct. But when i
press NO button it is deleting record which is not happen. I used for
delete query is like this

[ pstmtdel=con.prepareStatement("delete from ICLASS where
Sno='"Sno"'"); ]

[ pstmtdel.executeUpdate();]

And try with if condition also when i put query in if condition it's
showing an error .

Error is variable pstmtdel might not have been initialized

So, how can solve this one. Help me regarding this topic

Thanks
Jan Thomä - 18 Apr 2008 08:49 GMT
> [ pstmtdel=con.prepareStatement("delete from ICLASS where
> Sno='"Sno"'"); ]
[quoted text clipped - 5 lines]
>
> Error is variable pstmtdel might not have been initialized

Please provide the full code snippet you are referring to. I see no "if"
condition in the code snippet you provided, therefore it is impossible to
find out what your problem is.

Jan
Lew - 18 Apr 2008 12:43 GMT
smart wrote:
>> [ pstmtdel=con.prepareStatement("delete from ICLASS where
>> Sno='"Sno"'"); ]
[quoted text clipped - 5 lines]
>>
>> Error is variable pstmtdel might not have been initialized

Apparently you only set the variable down one path of the branch, and not the
other.

'pstmtdel' is a variable name that violates the naming convention.  Word parts
are supposed to begin with upper-case letters, except for the very first
letter, which is lower case, hence, 'pStmtDel'.  This is called "camel case",
often spelled "camelCase" to emphasize why.

What does the initial 'p' stand for?  Variable names are supposed to be
meaningful, in the context of the problem domain.

> Please provide the full code snippet you are referring to. I see no "if"
> condition in the code snippet you provided, therefore it is impossible to
> find out what your problem is.

Also, OP, answer this, what is "swings"?

There is a GUI library in Java called "Swing".  Perhaps that's what you meant.

Signature

Lew



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.