Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6544347
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T11:27:17+00:00 2026-05-25T11:27:17+00:00

in my application i am using the sql server database to store and retrieve

  • 0

in my application i am using the sql server database to store and retrieve the value from the database. Now i am fetching each row and add “~” between each column data. And at the time of calling the function i split it with the same(~). Now my problem is if some of the field is blank in the database so i didn’t return space so how can i manage the blank data to display in the write place. I am quite new for that. If know one can understand the scenario feel free to ask. thank u.

//Function Definition
public String[] selectPhoneDirectory(String siteId){
    String[] detailofemployee = new String[25];
    openConnection();
    String query = "Select * from Telephone_master with(nolock) where Site_ID = '"+siteId+"' order by User_Name";
    int i =0;
    try{
        rs = st.executeQuery(query);
        while(rs.next()){
            detailofemployee[i] = rs.getString(3)+"~"+rs.getString(4)+"~"+rs.getString(5)+"~"+rs.getString(6)+"~"+rs.getString(7);
            System.out.println("The Detail Is :"+detailofemployee[i]);
            i++;
        }
    }
    catch (Exception e) {
        System.out.println("Error!!!"+e);
    }
    closeConnection();
    return detailofemployee;
}

//Calling Function

for(int i = 0; i < siteName.length; i++){
    if(siteName[i].equalsIgnoreCase(strselectedName)){
        detailEmployee = gd.selectPhoneDirectory(siteId[i]);

    }
    for(int j = 0 ;j < detailEmployee.length ; j++){
    StringTokenizer st =new StringTokenizer(detailEmployee[j]);
        empName[j] = new String();
        empName[j] = st.nextToken("~").toString();
        System.out.println("The Name Is :"+empName[j]);

        empHome[j] = new String();
        empHome[j] = st.nextToken("~").toString();      
        System.out.println("The Home No Is :"+empHome[j]);

        empMob[j] = new String();
        empMob[j] = st.nextToken("~").toString();  
        System.out.println("The Mobile No Is :"+empMob[j]); 

        }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T11:27:18+00:00Added an answer on May 25, 2026 at 11:27 am
    String myStr =yourTableRaw ;
    

    use the replaceAll method

    this replace the consecutive ~ with one ~ character

    myStr = myStr.replaceAll("~+","~");
    

    then make the splite call

    String result []= myStr.split("~");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a web application, which is using a SQL Server 2005 database. My
If I can retrieve image data from sql-server database, which stored as image type.
I am developing a contact manager application using SQL Server 2008 (service-based database) .
My web application is using a SQL Server database that has around 2000 rows.
When I profile my application using SQL Server Profiler, I am seeing lots of
I need to write a web application using SQL Server 2005, asp.net, and ado.net.
Example scenario in an ASP.NET application using SQL Server membership provider : 1) a
What are the licences required for an asp.net (MVC) web application using sql server
My application (C++ using SQL Native Client with SQL Server 2000) is consistently finding
I am using SQL Server for my web application. How will I know that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.