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

  • SEARCH
  • Home
  • 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 6786653
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T17:16:18+00:00 2026-05-26T17:16:18+00:00

I am currently developing a C# Windows Form Application. Now I am trying to

  • 0

I am currently developing a C# Windows Form Application.

Now I am trying to use a SQL Command to retrieve information from the database to fill in the information that I need to have in my Application.

A sample query would be “select * from Member”

In the member table there would be variables like name, location, etc etc.

How do I code it in my application such that i can fill up my variables with the information from the database?

My code for the method would be

private Panel createNotificationPanel(String name, String location, String imageExtension, String alertType, String memberid)
    {

    }

I have already created a member class which includes all the set and get method for all this values

and currently what I have done so far is :

String connectionString =         ConfigurationManager.ConnectionStrings["connection2"].ConnectionString;
        SqlConnection conn = new SqlConnection(connectionString);
        SqlCommand cmd = new SqlCommand("select * from alert);
        SqlDataAdapter da = new SqlDataAdapter(cmd);

        DataSet dataset = new DataSet();

        conn.Open();
        da.Fill(dataset, "authenticate");
        conn.Close();


        int respond = (int)dataset.Tables["authenticate"].Rows[0]["respond"];

if (respond == 1)
        {
            //to fill in here
        }

after retrieving the information I am going to add it to a list as follow

List.Add(new MemberAlert("name", "location", "type", "memberID", "imageExtension"));

so i am wondering how do i replace the information inside with the one in the database
I am not sure of how do I proceed from here. can anyone help me with this?

  • 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-26T17:16:18+00:00Added an answer on May 26, 2026 at 5:16 pm
    DataSet dataset = new DataSet();
    using (SqlConnection connection = 
        new SqlConnection(connectionString))
    {
        SqlDataAdapter adapter = new SqlDataAdapter();
        adapter.SelectCommand = new SqlCommand(
            "select * from alert", connection);
        adapter.Fill(dataset, "authenticate");
    }
    
    // Load Data from the DataSet into the ListView
    private void LoadList()
    {
        // Get the table from the data set
        DataTable dtable = dataset.Tables["authenticate"];
    
        // Clear the ListView control
        listView1.Items.Clear();
    
        // Display items in the ListView control
        for (int i = 0; i < dtable.Rows.Count; i++)
        {
    
            DataRow drow = dtable.Rows[i];
    
            // Define the list items
            ListViewItem lvi = new ListViewItem(drow["name"].ToString());
            lvi.SubItems.Add (drow["location"].ToString());
            lvi.SubItems.Add (drow["type"].ToString());
            lvi.SubItems.Add (drow["memberID"].ToString());
            lvi.SubItems.Add (drow["imageExtension"].ToString());
    
            // Add the list items to the ListView
            listView1.Items.Add(lvi);
        }
    }
    

    if you need to create list out of dataset table. you can iterate rows as above and create list items inside the loop and add them to list.

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

Sidebar

Related Questions

I am currently developing a C# Windows Form Application that I intend to let
I am currently developing a C# Windows Form Application that I intend to let
I am currently developing a C# Windows Form Application. In the main form, there
I am currently developing a C# Windows Form Application. After the user has login
I am currently developing a C# Windows Form Application that I intend to let
I am currently developing a C# Windows Form Application that I intend to let
I am currently developing a C# Windows Form Application that I intend to let
I am currently developing a C# Windows Form Application that I intend to let
I'm using Windows XP and currently, I'm developing a small win form application so
Currently I am developing a windows form application in c# that has several forms.

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.