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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T04:34:28+00:00 2026-06-14T04:34:28+00:00

I am using SQLite for a data entry windows 8 app I am working

  • 0

I am using SQLite for a data entry windows 8 app I am working on. I can create the db, insert data, retrieve a column count, and read data, but cannot get the column names.

The underlying framework is from this post.

I read about the PRAGMA table_info(table_name); command but I cannot seem to send and read back this query properly. I have been googling for 3 days!

MainPage.xaml.cs:

using SQLite;
using SqlLiteTest.Model;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using Windows.Storage;
using Windows.UI.Popups;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;

namespace SqlLiteTest
{
    public sealed partial class MainPage : Page
    {
        public MainPage()
        {
            this.InitializeComponent();
            txtPath.Text = ApplicationData.Current.LocalFolder.Path;
        }

        private async void createDB(object sender, RoutedEventArgs e)
        {
            // access local folder
            var qvLocalFolder = Windows.Storage.ApplicationData.Current.LocalFolder;

            try
            {
                //Create a blank carrier file
                StorageFile qvLocalFileCarrier = await qvLocalFolder.CreateFileAsync("qvdbLocal.db", CreationCollisionOption.FailIfExists);

                //Write the blank carrier file
                await FileIO.WriteTextAsync(qvLocalFileCarrier, "");
            }
            catch { }

            // connect
            var path = Windows.Storage.ApplicationData.Current.LocalFolder.Path + @"\qvdbLocal.db";
            var db = new SQLiteAsyncConnection(path);

            // create table
            await db.CreateTableAsync<qvdb>();

            // insert data
            var insertRecords = new List<qvdb>()
            {
                new qvdb
                {
                            qvdbRecord = 1,
                            qvdbNotes = "Notes1",
                            qvdb001 = "Variable 1.1",
                            qvdb002  = "Variable 2.1"
                    },
                    new qvdb
                    {
                            qvdbRecord = 1,
                            qvdbNotes = "Notes1",
                            qvdb001 = "Variable 1.1",
                            qvdb002  = "Variable 2.1"
                    },
                    new qvdb
                    {
                            qvdbRecord = 1,
                            qvdbNotes = "Notes1",
                            qvdb001 = "Variable 1.1",
                            qvdb002  = "Variable 2.1"
                    },
            };

            await db.InsertAllAsync(insertRecords);

            // read count
            var allUsers = await db.QueryAsync<qvdb>("SELECT * FROM qvdb");
            var count = allUsers.Any() ? allUsers.Count : 0;

            Debug.WriteLine(count);
        }

        private async void updateDB(object sender, RoutedEventArgs e)
        {
            var path = Windows.Storage.ApplicationData.Current.LocalFolder.Path + @"\qvdbLocal.db";
            var db = new SQLiteAsyncConnection(path);

            var tempCell = db.QueryAsync<qvdb>("UPDATE qvdb SET qvdbNotes ='!@#$%$%^^&*()+)(*&^%$#@!{:L<>?' WHERE qvdbRecord = 10");
            await db.UpdateAsync(tempCell);
        }

        private async void readDB(object sender, RoutedEventArgs e)
        {
            var path = Windows.Storage.ApplicationData.Current.LocalFolder.Path + @"\qvdbLocal.db";
            var db = new SQLiteAsyncConnection(path);

            var query = db.Table<qvdb>();
            var result = await query.ToListAsync();
            foreach (var item in result)
            {
                MessageDialog dialog = new MessageDialog(string.Format("{0} {1} {2}", item.qvdbRecord, item.qvdbNotes, item.qvdb001));
                await dialog.ShowAsync();
            }
        }

        private void readColNames(object sender, RoutedEventArgs e)
        {
        }
    }
}

qvdb.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SQLite;

namespace SqlLiteTest.Model
{
    public class qvdb
    {
        [PrimaryKey, AutoIncrement]
        public int qvdbRecord { get; set; }

        [MaxLength(3000)]
        public string qvdbNotes { get; set; }

        [MaxLength(1000)]
        public string qvdb001 { get; set; }

        [MaxLength(1000)]
        public string qvdb002 { get; set; }

    }
}

Thanks CL for the info. I added the class but still do not know how to access them. Some more code…

    // this works
    // read record count
    var allRecords = await db.QueryAsync<qvdb>("SELECT * FROM qvdb");
    var countRecords = allRecords.Any() ? allRecords.Count : 0;
    this.textboxLog.Text = this.textboxLog.Text + Environment.NewLine + "There are " + countRecords + " records.";

    // ??
    // read column names
    var allColumns = await db.QueryAsync<qvdb>("PRAGMA table_info(qvdb)");
    foreach (var item in allColumns) {
       //read name
        this.textboxLog.Text = this.textboxLog.Text + Environment.NewLine + "columbn names";
    }
  • 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-06-14T04:34:30+00:00Added an answer on June 14, 2026 at 4:34 am

    o end the loop on CL’s advice, this code successfully reads the column names:

     // read column names
               var query = await db.QueryAsync<table_info_record>("PRAGMA table_info(MY_TABLE_NAME_HERE)");
    
                foreach (var item in query)
                {
                    Debug.WriteLine(string.Format("{0}", item.name) + " is a column.");
                }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i am working on data manipulation using sqlite. how can i insert the datetime
I'm trying to insert data into the SQLite database using get EditText, but I
I am using sqlite in my app, i want to edit some data in
I'm using SQLite in Windows from a .NET app. The .NET app is using
Im using SQLite as data storage for my Android App. I have created one
I am using SQLite from system.data.sqlite.org We need to access the database from many
I am using System.Data.SQLite to store my program's data and settings (in a WPF
In my application,i am using sqlite as a backend(to store data locially). I am
I'm using SQLite database. The problem is that data isn't written to base. NSLog
I am using an sqlite database to store log data. My table has a

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.