我如何实现对有子节点的tree的删除进行询问然后决定是否删除呢?
还有一个问题,看如下代码;
string strInsert = "INSERT INTO diary(riqi,neirong) VALUES('2006-4-8','2222')";
OleDbCommand inst = new OleDbCommand(strInsert, mydiary);
inst.ExecuteNonQuery();
可以插入,
但是如果我用一个变量代表当前时间,如何插入呢?上面的时间日期要用变量替换,但直接替换似乎不行
还有一个问题,看如下代码;
string strInsert = "INSERT INTO diary(riqi,neirong) VALUES('2006-4-8','2222')";
OleDbCommand inst = new OleDbCommand(strInsert, mydiary);
inst.ExecuteNonQuery();
可以插入,
但是如果我用一个变量代表当前时间,如何插入呢?上面的时间日期要用变量替换,但直接替换似乎不行
string message = "You did not enter a server name. Cancel this operation?";
string caption = "No Server Name Specified";
MessageBoxButtons buttons = MessageBoxButtons.YesNo;
DialogResult result; // Displays the MessageBox. result = MessageBox.Show(this, message, caption, buttons,
MessageBoxIcon.Question, MessageBoxDefaultButton.Button1,
MessageBoxOptions.RightAlign); if(result == DialogResult.Yes)
{ // Closes the parent form. this.Close(); }
第二个问题
Datetime t = Now().toshortDatetime;
"INSERT INTO diary(riqi,neirong) VALUES(#"& t &"#,'2222')";
MessageBoxIcon.Question, MessageBoxDefaultButton.Button1,
MessageBoxOptions.RightAlign) == DialogResult.Yes)
{
// 删除
}
else
{
//其它操作
}
-------
还有一个问题,看如下代码;
string strInsert = "INSERT INTO diary(riqi,neirong) VALUES('2006-4-8','2222')";
OleDbCommand inst = new OleDbCommand(strInsert, mydiary);
inst.ExecuteNonQuery();
可以插入,
但是如果我用一个变量代表当前时间,如何插入呢?上面的时间日期要用变量替换,但直接替换似乎不行
--------
INSERT INTO diary(riqi,neirong) VALUES('2006-4-8','2222')";
最好把时间都用数据服务器时间. 如下.
INSERT INTO diary(riqi,neirong) VALUES(sysdate,'2222')";
Datetime t = Now().toshortDatetime;
"INSERT INTO diary(riqi,neirong) VALUES(#"& t &"#,'2222')";
================================================================
这样似乎不行唉,还麻烦再看一下
"INSERT INTO diary(riqi,neirong) VALUES('"+ t.ToString() + "','2222')";
if( yourTreeview.SelectedNode.Nodes.Count > 0 )
{
if( MessageBox.Show( yourConfirmMessage, MessageButton ) != DialogResult.OK )
blnDeleted = false;
}if( blnDeleted )
yourTreeview.Nodes.Remove( yourTreeview.SelectedNode );
string strInsert = "INSERT INTO diary(riqi,neirong) VALUES( @riqi, @neirong )";
OleDbCommand inst = new OleDbCommand(strInsert, mydiary);inst.Parameters.Add( "@riqi", yourRiqiValue );
inst.Parameters.Add( "@neirong", yourNeirongValue );inst.ExecuteNonQuery();