Quantcast
Channel: SharpDevelop Community
Viewing all articles
Browse latest Browse all 1764

Il tipo 'System.Data.Common.DbConnection' è definito in un assembly di cui manca il riferimento.

$
0
0

I would like tostart usingSharpDevelop

Butin my testproject Iaddedthe reference System.Data.SqlServerCe

Thisis my project

/*
 * Creato da SharpDevelop.
 * Utente: Marco
 * Data: 27/03/2017
 * Ora: 9.59
 *
 * To change this template use Tools | Options | Coding | Edit Standard Headers.
 */
 
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
using System.Data;
using System.Data.Common;
using System.IO;
using System.Data.SqlServerCe;

namespace prova
{

    /// <summary>
    /// Description of MainForm.
    /// </summary>
    public partial class MainForm : Form
    {
        public static void Main(string[ args)
        {
            Application.Run(new MainForm());
        }
       
        public MainForm()
        {
            //
            // The InitializeComponent() call is required for Windows Forms designer support.
            //
            InitializeComponent();


 

            //
            // TODO: Add constructor code after the InitializeComponent() call.
            //
        }
       
        void Button1Click(object sender, EventArgs e)
        {
           
                        SqlCeConnection conn = null;
            try
                {
                conn = new SqlCeConnection("Data Source=Server2008; Integrated Security=SSPI; Initial Catalog=cmfspa;User Id=sa;Password=martina02");
                con.Open();
                SqlCeCommand cmd = con.CreateCommand();
                cmd.CommandText="SELECT ar_descr, ar_desint, ar_codart, ar_ubicaz FROM artico WHERE ar_codart = '" + Codice_articolo.ToUpper().Trim() + "' , con";
                cmd.ExecuteNonQuery();
               
            }
            finally
                {
                con.Close();
                    }
        }
    }
}

Ierror in

SqlCeConnection conn = null;

and

SqlCeCommand cmd = con.CreateCommand();

the error for SqlCeConnection and SqlCeCommand is

The'System.Data.Common.DbConnection'type isdefined in an assemblyof which thereferenceis missing.Addan assembly reference'System.Data,Version =2.0.0.0,Culture = neutral,PublicKeyToken=b77a5c561934e089'.(CS0012)


Viewing all articles
Browse latest Browse all 1764

Trending Articles