locked
Create CAB file with my sql CE databese and picture in my solution RRS feed

  • Question

  • Hello,

    I create CAB file from this tutorial here.  Where I 'm wrong, how to make to work on real Phone, I'm testing on HTC HD2

     

    1. For background in my Form I use picture with this code,

     

     private void Background_Load(object sender, EventArgs e)

            {

                _backgroundImage =  new Bitmap(@"\Program Files\Mobile\AEK.jpg");

                _backgroundImageRect = new Rectangle(0, 0, _backgroundImage.Width, _backgroundImage.Height);

            }

            protected override void OnPaintBackground(PaintEventArgs e)

            {

                base.OnPaintBackground(e);

                Graphics g = e.Graphics;

                g.DrawImage(_backgroundImage, this.ClientRectangle, _backgroundImageRect, GraphicsUnit.Pixel);

            }

            Bitmap _backgroundImage;

            Rectangle _backgroundImageRect; 

     

    In emulator works fine when I compile but when I make installation .CAB file and install on real phone didn't work, give me error.

     

    2. I use Microsoft SQL Server Compact Edition 3.5 database in my application. I fill ListView from table in database, use this code

     

    private void Form3_Load(object sender, EventArgs e)

            {

                listView1.View = View.Details;

                ListViewItem Item;

                SqlCeConnection con = new SqlCeConnection("Data Source =\\Program Files\\Mobile\\FirstDB.sdf");

                con.Open();

                SqlCeCommand com = new SqlCeCommand();

                com.Connection = con;

                com.CommandText = "select name, number, operator from PhoneBook";

                SqlCeDataReader read;

                read = com.ExecuteReader();

                while (read.Read())

                {

                    Item = new ListViewItem(read.GetValue(0).ToString());

                    Item.SubItems.Add(read.GetValue(1).ToString());

                    Item.SubItems.Add(read.GetValue(2).ToString());

                    listView1.Items.Add(Item);

                }

                con.Close();

     }

    And this works fine in emulator when I compile but when I make installation .CAB file and install on real phone didn't work, give me error.

     

     

    This is my First application, maybe my installation .CAB file is not good.

     

    Thanks


    Wednesday, June 1, 2011 9:52 AM

Answers

  • Hey,

    I resolve my problem. The First time I install application on my storage card and a got error. Now I install application on Device and works fine :) This is funy problem

    If anyone have better solution please write.
    Wednesday, June 1, 2011 12:17 PM

All replies

  • Hey,

    I resolve my problem. The First time I install application on my storage card and a got error. Now I install application on Device and works fine :) This is funy problem

    If anyone have better solution please write.
    Wednesday, June 1, 2011 12:17 PM
  • Hi,

     

    I think the file path cause this problem.

     

    Best regards,

    Jesse


    Jesse Jiang [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Friday, June 3, 2011 2:54 AM