Click here to Skip to main content
15,888,733 members
Home / Discussions / C#
   

C#

 
GeneralRe: How to create filtering for DataTable based on toggle switches? Pin
Alex Dunlop27-Jul-21 22:03
Alex Dunlop27-Jul-21 22:03 
GeneralRe: How to create filtering for DataTable based on toggle switches? Pin
OriginalGriff27-Jul-21 22:13
mveOriginalGriff27-Jul-21 22:13 
GeneralRe: How to create filtering for DataTable based on toggle switches? Pin
Alex Dunlop27-Jul-21 23:35
Alex Dunlop27-Jul-21 23:35 
GeneralRe: How to create filtering for DataTable based on toggle switches? Pin
OriginalGriff28-Jul-21 0:47
mveOriginalGriff28-Jul-21 0:47 
GeneralRe: How to create filtering for DataTable based on toggle switches? Pin
Alex Dunlop28-Jul-21 20:11
Alex Dunlop28-Jul-21 20:11 
GeneralRe: How to create filtering for DataTable based on toggle switches? Pin
OriginalGriff28-Jul-21 22:00
mveOriginalGriff28-Jul-21 22:00 
AnswerRe: How to create filtering for DataTable based on toggle switches? Pin
jsc4227-Jul-21 23:35
professionaljsc4227-Jul-21 23:35 
QuestionHow to copy DataTable contents into SQLite table? Pin
Alex Dunlop26-Jul-21 20:37
Alex Dunlop26-Jul-21 20:37 
Hi,
My DataTable has 40 columns. I have created a Database and a table with 40 columns for SQLite programmatically.
I want to copy all my contents in DataTable into SQLite table. I used this class code:

public class SQLiteFunction
    {
        //Path of database
        public string databaseName { get; set; }
        public string dataTableName { get; set; }

        private DataTable dt = new DataTable();
        public SQLiteFunction()
        {
            dt.TableName = dataTableName;
        }

        public void Create_db()
        {
            if (!File.Exists(databaseName))
            {
                using (var sqlite = new SQLiteConnection(@"Data Source=" + databaseName))
                {
                    sqlite.Open();
                    string script = File.ReadAllText(@"CreateTable.sql");
                    SQLiteCommand command = new SQLiteCommand(script, sqlite);
                    command.ExecuteNonQuery();
                    sqlite.Close();
                }
            }
        }
        public void InsertData()
        {
            SQLiteConnection con = new SQLiteConnection(@"Data Source=" + databaseName);
            con.Open();
            SQLiteDataAdapter dAdapter = new SQLiteDataAdapter("SELECT FROM MyTable", con);
            SQLiteCommandBuilder cmdBuilder = new SQLiteCommandBuilder(dAdapter);
            dAdapter.Fill(dt);
        }
    }

When I use InserData() method, there is no runtime error but my SQLite table is still empty.
Please help me.
AnswerRe: How to copy DataTable contents into SQLite table? Pin
OriginalGriff26-Jul-21 21:06
mveOriginalGriff26-Jul-21 21:06 
GeneralRe: How to copy DataTable contents into SQLite table? Pin
Alex Dunlop26-Jul-21 21:16
Alex Dunlop26-Jul-21 21:16 
GeneralRe: How to copy DataTable contents into SQLite table? Pin
Alex Dunlop26-Jul-21 22:58
Alex Dunlop26-Jul-21 22:58 
GeneralRe: How to copy DataTable contents into SQLite table? Pin
OriginalGriff26-Jul-21 23:09
mveOriginalGriff26-Jul-21 23:09 
GeneralRe: How to copy DataTable contents into SQLite table? Pin
Alex Dunlop27-Jul-21 0:39
Alex Dunlop27-Jul-21 0:39 
AnswerRe: How to copy DataTable contents into SQLite table? Pin
Richard Andrew x6428-Jul-21 2:36
professionalRichard Andrew x6428-Jul-21 2:36 
QuestionRTD communication error (COM) / .ConnectData(Int32 topicId, Object[]& parameters, Boolean& newValue) Pin
Juliano Zucatti26-Jul-21 10:14
Juliano Zucatti26-Jul-21 10:14 
QuestionHow to shuffle an array VS Windows Form Application? Pin
Sofi081326-Jul-21 0:26
Sofi081326-Jul-21 0:26 
AnswerRe: How to shuffle an array VS Windows Form Application? Pin
OriginalGriff26-Jul-21 0:40
mveOriginalGriff26-Jul-21 0:40 
GeneralRe: How to shuffle an array VS Windows Form Application? Pin
Sofi081326-Jul-21 1:22
Sofi081326-Jul-21 1:22 
AnswerRe: How to shuffle an array VS Windows Form Application? Pin
Richard MacCutchan26-Jul-21 0:42
mveRichard MacCutchan26-Jul-21 0:42 
QuestionHow to find average value for duplicate keys in Dictionary? Pin
Alex Dunlop24-Jul-21 4:29
Alex Dunlop24-Jul-21 4:29 
AnswerRe: How to find average value for duplicate keys in Dictionary? Pin
Alex Dunlop24-Jul-21 6:29
Alex Dunlop24-Jul-21 6:29 
GeneralRe: How to find average value for duplicate keys in Dictionary? Pin
Gerry Schmitz24-Jul-21 6:44
mveGerry Schmitz24-Jul-21 6:44 
AnswerRe: How to find average value for duplicate keys in Dictionary? Pin
OriginalGriff24-Jul-21 6:47
mveOriginalGriff24-Jul-21 6:47 
AnswerRe: How to find average value for duplicate keys in Dictionary? Pin
BillWoodruff28-Jul-21 3:11
professionalBillWoodruff28-Jul-21 3:11 
QuestionEfficient method to build a CSV string Pin
Vikas Mishra Jul202123-Jul-21 10:46
Vikas Mishra Jul202123-Jul-21 10:46 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.