Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. help on sql CE update

help on sql CE update

Scheduled Pinned Locked Moved Database
helpdatabasecssannouncement
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Z Offline
    Z Offline
    zigzagooo
    wrote on last edited by
    #1

    the problem that my code does the update during the same run while iam out and run again i find nothing of the updates i think it's a comminting problem anyway hope anyone help me!! plz check the code:

    public partial class Form1 : Form
    {
    static SqlCeConnection _connection = null;
    public static SqlCeConnection Connection
    {
    get
    {
    if (_connection == null)
    {
    _connection = new SqlCeConnection(ConnectionString);
    _connection.Open();
    }
    return _connection;
    }
    }
    public Form1()
    {
    InitializeComponent();
    }
    public static DataSet ds = new DataSet();
    public static int rowindex = -1;
    private void menuExit_Click(object sender, EventArgs e)
    {
    Close();
    }

        #region File & Database Details
    
       static string CurrentFolder
        {
            get { return Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase); }
        }
    
        const string \_databaseLocalFileName = "DB1.sdf";
       static string DatabasePathName
        {
            get { return Path.Combine(CurrentFolder, \_databaseLocalFileName); }
        }
    
        const string \_baseConnectionString = "Data Source =";
       static string ConnectionString
        {
            get { return \_baseConnectionString + DatabasePathName; }
        }
    
        #endregion
    
        private void menuedit\_Click(object sender, EventArgs e)
        {          
            rowindex = dataGrid1.CurrentRowIndex;
            if (dataGrid1.DataSource != null)
            {
                panel1.Visible = true;
                txtcol1.Text = ds.Tables\[0\].Rows\[rowindex\].ItemArray\[0\].ToString();
                txtcol2.Text = ds.Tables\[0\].Rows\[rowindex\].ItemArray\[1\].ToString();
                txttblID.Text = ds.Tables\[0\].Rows\[rowindex\].ItemArray\[2\].ToString();
            }
            else
                MessageBox.Show("should load data grid first", "error", MessageBoxButtons.OK, MessageBoxIcon.Hand, MessageBoxDefaultButton.Button1);
        }
        public static SqlCeDataAdapter adap;
        
    
        private void btnsave\_Click\_1(object sender, EventArgs e)
        {
            try
            {
                SqlCeCommand cmdUpdate = Connection.CreateCommand();
                SqlCeTransaction se = Connection.BeginTr
    
    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups