How to get a particular column from table and display in in label and not in the list in sqlite database in mvvm model

Gbenga Banuso Odumosu 40 Reputation points
2024-06-08T10:40:43.1+00:00

In MVVM model using async connection, I want to retrieve just one column from my async table to a label not to list. all sample I am seeing put all column in the list . I want only one mesa1 column to be displayed in a label.text.

public async Task
SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
13,997 questions
.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
3,595 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
11,011 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Leon Lu (Shanghai Wicresoft Co,.Ltd.) 76,551 Reputation points Microsoft Vendor
    2024-06-10T01:32:40.6633333+00:00

    Can you share your code about ServiceData? If the ServiceData.cs is like following code.

    public class ServiceData
    {
         public string Name { get; set; }
         public int RegNo { get; set; }
    }
    

    If you want to get the column called Name and set it to the label. Please use following code to get it.

    ServiceData serviceData=await GetItem(regno);
    myid.Text=serviceData.Name;
    

    If not, please share your code about ServiceData.cs.

    1 person found this answer helpful.

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.