程序如下:
numericUpDown.Enabled = true;
numericUpDown.Value = 5;
numericUpDown.Increment =0.01m;);//此处有问题吗
numericUpDown.ValueChanged+=new EventHandler(numericUpDown_ValueChanged);//此处有问题吗
private void btnOk_Click(object sender, System.EventArgs e)
{
SqlCeConnection conn = null;
try
{ conn = new SqlCeConnection(@"Data Source =\Program Files\RealtimeMonitor\realtimedata.sdf");
conn.Open();
String sql = "insert into AP([power02]) values ('" + this.numericUpDown.Value + "')";
SqlCeCommand cmd = new SqlCeCommand(sql, conn);
cmd.CommandType = CommandType.Text;
cmd.ExecuteNonQuery();
}
catch (SqlCeException sqlex)
{
foreach (SqlCeError sqlerror in sqlex.Errors)
{ MessageBox.Show(sqlerror.Message); }
} finally { if (conn.State != ConnectionState.Closed) { conn.Close(); } }
this.Close();
}
private void numericUpDown_ValueChanged(object sender, EventArgs e)
{}
我用的是VS.net2005、SQL Mobile、Windows CE平台,想把控件numericUpDown的值存到数据库里,为啥实现不了自动增加值,就是实现不了Valuechanged属性。请大虾帮忙。AP是表名,power02是列名,
numericUpDown.Enabled = true;
numericUpDown.Value = 5;
numericUpDown.Increment =0.01m;);//此处有问题吗
numericUpDown.ValueChanged+=new EventHandler(numericUpDown_ValueChanged);//此处有问题吗
private void btnOk_Click(object sender, System.EventArgs e)
{
SqlCeConnection conn = null;
try
{ conn = new SqlCeConnection(@"Data Source =\Program Files\RealtimeMonitor\realtimedata.sdf");
conn.Open();
String sql = "insert into AP([power02]) values ('" + this.numericUpDown.Value + "')";
SqlCeCommand cmd = new SqlCeCommand(sql, conn);
cmd.CommandType = CommandType.Text;
cmd.ExecuteNonQuery();
}
catch (SqlCeException sqlex)
{
foreach (SqlCeError sqlerror in sqlex.Errors)
{ MessageBox.Show(sqlerror.Message); }
} finally { if (conn.State != ConnectionState.Closed) { conn.Close(); } }
this.Close();
}
private void numericUpDown_ValueChanged(object sender, EventArgs e)
{}
我用的是VS.net2005、SQL Mobile、Windows CE平台,想把控件numericUpDown的值存到数据库里,为啥实现不了自动增加值,就是实现不了Valuechanged属性。请大虾帮忙。AP是表名,power02是列名,
那半个括号是干啥的呀