Click here to Skip to main content
15,887,135 members
Home / Discussions / C#
   

C#

 
GeneralRe: ManagementScope, did it get deprecated or something? Pin
OriginalGriff18-Apr-18 8:02
mveOriginalGriff18-Apr-18 8:02 
GeneralRe: ManagementScope, did it get deprecated or something? Pin
Robert Oujesky18-Apr-18 8:49
Robert Oujesky18-Apr-18 8:49 
GeneralRe: ManagementScope, did it get deprecated or something? Pin
OriginalGriff18-Apr-18 9:15
mveOriginalGriff18-Apr-18 9:15 
QuestionHow can I add the distance value between the line(from point A to point B) in C#? Pin
Member 1378306217-Apr-18 22:27
Member 1378306217-Apr-18 22:27 
AnswerRe: How can I add the distance value between the line(from point A to point B) in C#? Pin
OriginalGriff17-Apr-18 22:35
mveOriginalGriff17-Apr-18 22:35 
AnswerRe: How can I add the distance value between the line(from point A to point B) in C#? Pin
V.17-Apr-18 23:56
professionalV.17-Apr-18 23:56 
AnswerRe: How can I add the distance value between the line(from point A to point B) in C#? Pin
Gerry Schmitz18-Apr-18 6:03
mveGerry Schmitz18-Apr-18 6:03 
Questionhow to deploy your software (set up) Pin
ago248617-Apr-18 6:03
ago248617-Apr-18 6:03 
Hi programmer friend, I finished my software that is connected to a SQLite database that works perfectly and I wanted to deploy it on another machine. I have an error message: Can not load file or assembly 'System.Data.SQlite.
Version = 1.0.108.0. Culture = neutral. PublicKeyToken = db937bc2d44ff139 '
or one of his dependencies. The specified file can not be found

Thank you for bringing me your help here is the connectoin code:
(
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.OleDb;
using System.Data.SQLite;

namespace Acode
{
    public partial class Form1: Form
    {
        public Form1 ()
        {
            InitializeComponent ();
            
           
        }
        private SQLiteConnection sql_con;
private SQLiteCommand sql_cmd;
        private SQLiteDataAdapter DB;
private DataSet DS = new DataSet ();
private DataTable DT = new DataTable ();

        private void setConnection ()
{
            // CONNECTING TO THE DATABASE
sql_con = new SQLiteConnection (@ "Data Source = DBcode.db; Version = 3; New =; Compress = True;");
}

        private void LoadData ()
        {
            SetConnection ();
            sql_con.Open ();
            sql_cmd = sql_con.CreateCommand ();
            string CommandText = "select * from InfoCode";
            DB = new SQLiteDataAdapter (CommandText, sql_con);
            DS.Reset ();
            DB.Fill (DS);
            DT = DS.Tables [0];
            dataGridView1.DataSource = DT;
            sql_con.Close ();
        }

        private void Form1_Load (object sender, EventArgs e)
        {
            LoadData ();

        }

        private void ExecuteQuery (String txtQuery)
{
        SetConnection ();
sql_con.Open ();
sql_cmd = sql_con.CreateCommand ();
sql_cmd.CommandText = txtQuery;
sql_cmd.ExecuteNonQuery ();
sql_con.Close ();
}

        public static string randomstring (int length)
        {
            const string chars = "ABCDEFGHIJKLMNOPQRSTUVWYZ0123456789";
            Random random = new Random ();
            return new string (Enumerable.Repeat (floats, length) .Select (s => s [random.Next (s.Length)]). ToArray ());
        }
        private void btnGenerer_Click (object sender, EventArgs e)
        {
           
            lblDisplay.Text = randomstring (4);
            txtAfficPrice.Text = "100";
        }

        private void button1_Click (object sender, EventArgs e)
        {
            lblDisplay.Text = randomstring (5);
            txtAffichPrice.Text = "300";
        }

        private void button2_Click (object sender, EventArgs e)
        {
            lblDisplay.Text = randomstring (6);
            txtAffichPrice.Text = "500";
        }

       
        private void btnRegister_Click (object sender, EventArgs e)
        {
            if (lblDisplay.Text == "")
            {
                MessageBox.Show ("Please generate the code");
            }
            else
            {
                using (SQLiteConnection con = new SQLiteConnection (sql_con))
                {
                    try
                    {
                        con.Open ();
                        // Insert code to process data.
                        using (SQLiteCommand cmd = new SQLiteCommand ("INSERT INTO InfoCode (Code, DateCode, PriceCode) VALUES (@Code, @DateCode, @CodePrice)", con))
                        {
                            cmd.Parameters.AddWithValue ("@ Code", lblDisplay.Text);
                            cmd.Parameters.AddWithValue ("@ DateCode", dateTimePicker1.Text);
                            cmd.Parameters.AddWithValue ("@ PriceCode", txtAfficPrice.Text);
                            cmd.ExecuteNonQuery ();
                        }
                        LoadData ();
                        MessageBox.Show ("Registration completed successfully");
                        lblDisplay.Text = "";
                        groupBoxGenerer.Enabled = false;
                        btnSave.Enabled = false;
                        btnPrint.Enabled = true;
                        This.Refresh ();
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show ("Failed to connect to data source" + ex.Message);
                    }
                    finally
                    {
                        con.Close ();
                    }
                    
                    
                }
            }
        }

        private void btnAdd_Click (object sender, EventArgs e)
        {
            groupBoxGenerer.Enabled = true;
            btnSave.Enabled = true;
        }

        private void exitToolStripMenuItem_Click (object sender, EventArgs e)
        {
            this.Close ();
            FrmAuthentification
D'Oh! | :doh: D'Oh! | :doh:
AnswerRe: how to deploy your software (set up) Pin
Richard MacCutchan17-Apr-18 6:11
mveRichard MacCutchan17-Apr-18 6:11 
GeneralRe: how to deploy your software (set up) Pin
ago248617-Apr-18 6:20
ago248617-Apr-18 6:20 
GeneralRe: how to deploy your software (set up) Pin
ago248617-Apr-18 6:38
ago248617-Apr-18 6:38 
GeneralRe: how to deploy your software (set up) Pin
Richard MacCutchan17-Apr-18 6:41
mveRichard MacCutchan17-Apr-18 6:41 
GeneralRe: how to deploy your software (set up) Pin
ago248617-Apr-18 6:52
ago248617-Apr-18 6:52 
GeneralRe: how to deploy your software (set up) Pin
Richard MacCutchan17-Apr-18 8:45
mveRichard MacCutchan17-Apr-18 8:45 
GeneralRe: how to deploy your software (set up) Pin
ago248617-Apr-18 22:35
ago248617-Apr-18 22:35 
GeneralRe: how to deploy your software (set up) Pin
Richard MacCutchan17-Apr-18 22:38
mveRichard MacCutchan17-Apr-18 22:38 
GeneralRe: how to deploy your software (set up) Pin
ago248617-Apr-18 22:57
ago248617-Apr-18 22:57 
GeneralRe: how to deploy your software (set up) Pin
ago248617-Apr-18 23:48
ago248617-Apr-18 23:48 
GeneralRe: how to deploy your software (set up) Pin
Richard MacCutchan17-Apr-18 23:56
mveRichard MacCutchan17-Apr-18 23:56 
GeneralRe: how to deploy your software (set up) Pin
ago248618-Apr-18 0:00
ago248618-Apr-18 0:00 
GeneralRe: how to deploy your software (set up) Pin
ago248618-Apr-18 0:01
ago248618-Apr-18 0:01 
GeneralRe: how to deploy your software (set up) Pin
Richard MacCutchan18-Apr-18 0:13
mveRichard MacCutchan18-Apr-18 0:13 
GeneralRe: how to deploy your software (set up) Pin
ago248618-Apr-18 0:16
ago248618-Apr-18 0:16 
AnswerRe: how to deploy your software (set up) Pin
Gerry Schmitz18-Apr-18 6:24
mveGerry Schmitz18-Apr-18 6:24 
GeneralRe: how to deploy your software (set up) Pin
ago248618-Apr-18 6:52
ago248618-Apr-18 6:52 

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.