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 493929
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T05:27:03+00:00 2026-05-13T05:27:03+00:00

Scenario: I have a list table being populated from a combobox. That list table

  • 0

Scenario: I have a list table being populated from a combobox. That list table can have up to 50 things listed in it(whats listed in the listbox is column names). Tricky part: I have a text file that matches one field in the sql table. X1,X2,X3 are the listbox items.

So i basically need:

select <line in text file>, from <blah> where id = object_id('table')  
export <x2>,<x3>,<x4>,<x5>,<x6>,C:\Comma.text

I dont need help making the listbox, or the SQL connection.

Just basically how do i list my listbox in strings (no matter what the order selected is to represent whatever was selected in that order, and the SQL command to match based on textfile and export it.)

I know this one is going to be a pain. Thanks in advanice

  • 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-13T05:27:03+00:00Added an answer on May 13, 2026 at 5:27 am

    Your question isn’t very clear… does the text file contain the primary key values for rows in the table?

    If that is the case, your SQL pseudo code will look like so:

    select <selectedColumn1>, <selectedColumn2>,...  
    from yourTable  
    where primarykeyColumn in (<yourTextFileValues>)  
    

    As to how to get selected items from a listbox to a string, and format a SQL statement to only select those rows from the database to export, here is one way:

    string[] selectedColumns = new string[myListBox.SelectedItems.Count];
    for(int i = 0; i < myListBox.SelectedItems.Count; i++)
    {
        selectedColumns[i] = myListBox.SelectedItems[i].ToString();
    }
    string exportColumns = string.Join(",", selectedColumns);
    
    //format your sql statement
    string sqlStatement = string.Format("select {0} from YourTable WHERE blah=blah2", 
                                         exportColumns);
    

    If everything in the list box is considered ‘selected’ for export, then just replace myListBox.SelectedItems with myListBox.Items

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have a scenario where we want to display a list of items and
Scenario: You have an ASP.Net webpage that should display the next image in a
Scenario: I have a text file that has pipe (as in the | character)
The scenario: we have a web system that automatically generates office 2003 excel files
Here's my scenario - I have an SSIS job that depends on another prior
Here's the scenario: You have a Windows server that users remotely connect to via
Scenario: I have the following structure; Group (parent) -> Item (child). A Group can
Scenario: I have a generic list of Audits and a generic list of AuditImages.
I have a simple (hopefully) scenario. Seats table Computers table SeatComputers table (since a
I have he following scenario: Got an HTML template file that will be used

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.