New project and i need help with haveing something show up....  
Author Message
Zombie_002





PostPosted: Visual C# Language, New project and i need help with haveing something show up.... Top

if you would like to see what i am talking about when i ask for help you can download what i have done so far here: www.team****ia.com/downloads/Team****ia.SerialKeyHolder.zip

some of you might of noticed that i was working on another project i have put that one off to the side for the moment and i am starting a new one to help me learn a little bit

I am making a product that will store your serial keys for you, for programs because i keep loosing mine and this will organize them and store them

And this is what i am asking for help with:   when you look at the program you will see a list view box with 2 sections one section is product and the other is the serial key i have got it to save the product under the product section but i need to figure out how do i get the serial to save under the serial section here is my code that i have so far:

using System;
using System.Collections.Generic;
using System.Text;
using System.Data.SQLite;

namespace Team****ia.SerialKeyHolder
{
    class SerialDB
    {
        private SQLiteConnection connection;

        public SerialDB()
        {
            InitializeConnection();
            CreateTables();
        }

        ~SerialDB()
        {
            DisposeConnection();           
        }

        public void CreateTables()
        {

            object scalar;
            SQLiteCommand cmd = connection.CreateCommand();

            // Create Product Table
            cmd.CommandText = "SELECT name FROM sqlite_master WHERE type='table' AND name='product';";
            scalar = cmd.ExecuteScalar();
            if (scalar == null)
            {
                cmd.CommandText = "CREATE TABLE product (id INTEGER PRIMARY KEY AUTOINCREMENT, product VARCHAR(250), serial VARCHAR(200));";
                cmd.ExecuteScalar();
            }
        }

        public SQLiteDataReader SelectProduct()
        {
            SQLiteCommand cmd = connection.CreateCommand();
            cmd.CommandText = "SELECT * FROM product;";
            return cmd.ExecuteReader();
        }

        public int InsertProduct(string product, string serial)
        {
            SQLiteCommand cmd = connection.CreateCommand();
            cmd.CommandText = String.Format("INSERT INTO product (product,serial) VALUES ('{0}','{1}');", product, serial);
            return cmd.ExecuteNonQuery();
        }
        // Start Connection
        private void InitializeConnection()
        {
            connection = new SQLiteConnection("Data Source=Serials.SKH");
            connection.Open();
            Console.WriteLine("Connection opened.");
        }
        // Stop Connection
        private void DisposeConnection()
        {
            try
            {
                if (connection.State != System.Data.ConnectionState.Closed)
                    connection.Close();
            }
            catch (Exception) { }
            Console.WriteLine("Connection closed.");
        }
    }
}



Visual C#3  
 
 
cverdon





PostPosted: Visual C# Language, New project and i need help with haveing something show up.... Top

Hi,

I don't have time to look at your app, but you might find these resources helpful:

ASP.NET 2.0: http://quickstarts.asp.net/QuickStartv20/aspnet/

Winforms: http://www.windowsforms.net/ and http://samples.gotdotnet.com/quickstart/winforms/

The online MSDN Developer's Guide for Windows Form Applications is also indispensible:

http://msdn2.microsoft.com/en-us/library/ms644558.aspx

They will all teach you the basics of databinding and data access.

Regards,
Charles