Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Type mismatch

Posted on 2006-04-27
6
Medium Priority
?
476 Views
Last Modified: 2012-05-05
hi,

I'm getting error for "events" - Error: Type Mismatch: cannot convert from String to String[]

while (rs.next())                   
        {
        String[] events =  rs.getString("USERID");
      }

Thx,
PH
0
Comment
Question by:princehyderabad
  • 4
  • 2
6 Comments
 
LVL 11

Expert Comment

by:fargo
ID: 16555435
events is defined as String array and you are getting String from resultset.

this is why u have type mismatch
either u need this
String events =  rs.getString("USERID");

OR
String[] events = new String[1]; //change the length accd to ur need
events[0] = rs.getString("USERID");

0
 
LVL 11

Expert Comment

by:fargo
ID: 16555450
i forgot to ask, what exactly are u willing to do with resultset data. the handling with variable events needs to be clarified to us.
0
 

Author Comment

by:princehyderabad
ID: 16555553
This is what exactly I'm trying to do:

      String ss="SELECT USERID FROM USERS";
            ResultSet rs= stmt.executeQuery(ss);                  
              while (rs.next())                   
        {
        String[] events =  rs.getString("USERID");
            }

pager.setV(new Vector(Arrays.asList(events)));
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 11

Accepted Solution

by:
fargo earned 200 total points
ID: 16555842
String ss="SELECT USERID FROM USERS";
          ResultSet rs= stmt.executeQuery(ss);              
ArrayList events = new ArrayList();
            while (rs.next())                
        {
        String userId =  rs.getString("USERID"));
        if(userId!=null)
           events.add(userId);
          }

pager.setV(new Vector(events);
0
 

Author Comment

by:princehyderabad
ID: 16557004
>> pager.setV(new Vector(events));

Error: events cannot be resolved
0
 
LVL 11

Expert Comment

by:fargo
ID: 16560109
in first place, why u are using Vector?

 >> pager.setV(new Vector(events));
Error: events cannot be resolved

did u change the code for the init of arraylist? Post ur recent code section.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Ready to kick start your career in 2018? Add app developer skills to your resume. January’s Course of the Month features Android App Development training with hands-on learning.  Read on to learn why these skills are important.
How do you create a user-centered user experience on your website? And what are some things you should consider in the process?
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Kernel Data Recovery is a renowned Data Recovery solution provider which offers wide range of softwares for both enterprise and home users with its cost-effective solutions. Let's have a quick overview of the journey and data recovery tools range he…

578 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question