Java sql execute with more variable

I have a frame with 50 label, i can select them, for example i select A1,A2,A3,A4 the program save these in string (String=A1;A2;A3;A4) and i want to call in this query

    try{

   String sql= "UPDATE Teremszekek SET Állapot='Foglalt' where Terem='1' and Szék='A1' and DKód='1' ";  

         PreparedStatement pst=conn.prepareStatement(sql);
          pst.execute();
        }catch(Exception e){
            System.out.println(e);
        }

    }

Állapot=condition(available,unavailable) Terem=room(index of room) Szék=chair DKód=Date code

How can i write that if i choose, A1,A2,A3,A4 etc label then it paste to query

//i select them at the same time

Answers


If I understand your question in the right way, this should be your solution:

String sql= "UPDATE Teremszekek SET Állapot='Foglalt' where Terem='1' and Szék=? and DKód='1' ";  

pst.setString(1, yourValue);

Need Your Help

CIPixellate output image size is different

iphone ios6 cifilter imagefilter

I am using CIPixellate for pixelating image in ios6. It results in bigger image. How can I keep the original size?

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.