help sql CE update problem
Mobile
1
Posts
1
Posters
0
Views
1
Watching
-
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.BeginTran