Click here to Skip to main content
15,892,643 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi everyone ...
im trying to create create windows mobile application with Sqlite database but when i try to debug it it show this error
The type 'System.Data.Common.DbCommand'
is defined in an assembly that is not referenced.
You must add a reference to assembly 'System.Data,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'

and this is my code
C#
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Data.SQLite;
using System.Windows.Forms;


namespace SmartDeviceProject1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            SQLiteConnection sqlite_conn;
            SQLiteCommand sqlite_cmd;
            SQLiteDataReader sqlite_datareader;

           
sqlite_conn = new SQLiteConnection("DataSource=Tsdatabase.db;Version=3;New=True;Compress=True;");
         
            sqlite_conn.Open();

            
            sqlite_cmd = sqlite_conn.CreateCommand();

            
            sqlite_cmd.CommandText = "CREATE TABLE Name (id integer primary key, text varchar(100));";
          
            sqlite_cmd.ExecuteNonQuery();

             sqlite_cmd.CommandText = "INSERT INTO Name (id, text) VALUES (1, 'john');";

             sqlite_cmd.ExecuteNonQuery();

             sqlite_cmd.CommandText = "INSERT INTO Name (id, text) VALUES (2, 'john2');";
            
            sqlite_cmd.ExecuteNonQuery();

            
            sqlite_cmd.CommandText = "SELECT * FROM test";

                   sqlite_datareader = sqlite_cmd.ExecuteReader();

                                
            sqlite_conn.Close();
        }
    }
}
Posted
Updated 17-Apr-18 19:34pm
v2

So, what keeps you from adding the reference now?

Right click Reference and select Add Reference... In the window that comes up, select the assembly that is required to be referenced. Click Ok!

Your project would compile now, if there is no other problem now.
 
Share this answer
 
Comments
jame01 8-Mar-15 8:01am    
thank you for your replay mr,Afzaal Ahmad Zeeshan
can you tell me which reference?
because added references i think issue is with platform {with windows mobile when i got this error i change target platform to x86 the error would disappear} but in here i use windows mobile 6.5 there is no target platform....
Afzaal Ahmad Zeeshan 8-Mar-15 8:18am    
You should get some guidance from the message that is being given to you, You must add a reference to assembly 'System.Data,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
.
jame01 8-Mar-15 8:28am    
mr.afzaal ahmad i have searched a lot and couldn't find solution :( there is not much guidance about mobile windows,,,,, so
i hope so so much i can find solution here
Afzaal Ahmad Zeeshan 8-Mar-15 8:30am    
Can't you find that library inside that Add References window? If there is no such library, then you need to re-install the SDK.
jame01 8-Mar-15 8:41am    
no i couldn't find that library and im such stuck here,,,mr,afzaal can i programmatically set target platform version?
my problem is still unsolved at yet :(
so i found this solution in google but i didn't know how to do it so please can you help me with explain it more plz,,,,
{In the Windows folder there is a utility called wceload.exe. Use the device's command prompt to install cabs with this utility, it should install them properly}

your help will be so appreciate
 
Share this answer
 
hi everyone ...
after a lot lot off effort at end i could solve my problem so one day may it be helpful for someone i gone put the solution here ,,,
connect your device and open it and paste "Wc400" this file inside the smart device anywhere
{C:\Program Files (x86)\Microsoft.NET\SDK\CompactFramework\v2.0\WindowsCE\wce400}
and open your device install "Wc400" its done :)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900