strSQL = "update table set title=@title,content=@content where id="+id+""
myConn = New OleDbConnection(strConn)
myCommand = New OleDbCommand(strSQL, myConn)
myCommand.Parameters.Add("@title",new_title.text)
myCommand.Parameters.Add("@content",content.text)
strSQL = "insert into table (title,content) values (@title, @content)"
myCommand = New OleDbCommand(strSQL, myConn)
myCommand.Parameters.Add("@title",new_title.text)
myCommand.Parameters.Add("@content",content.text)
这样写可以,,,,
有一个奇怪的问题,,,,当
myCommand.Parameters.Add("@title",new_title.text)
myCommand.Parameters.Add("@content",content.text)
的顺序是
myCommand.Parameters.Add("@content",content.text)
myCommand.Parameters.Add("@title",new_title.text)
时,,,那么添加后的记录tilte 和 content 就换位了,难道@title不是类似ID的作用? 不理解~~~
补充(这个没试)
string strSql = "insert into table1 (col1,col2) values (@col1,@col2)";
SqlParameter [] Params = new SqlParameter[2];
Params[1] = new SqlParameter();
Params[1].ParameterName = "@col1";
Params[1].value = "aaron's blog";
myConn = New OleDbConnection(strConn)
myCommand = New OleDbCommand(strSQL, myConn)
myCommand.Parameters.Add("@title",new_title.text)
myCommand.Parameters.Add("@content",content.text)
strSQL = "insert into table (title,content) values (@title, @content)"
myCommand = New OleDbCommand(strSQL, myConn)
myCommand.Parameters.Add("@title",new_title.text)
myCommand.Parameters.Add("@content",content.text)
这样写可以,,,,
有一个奇怪的问题,,,,当
myCommand.Parameters.Add("@title",new_title.text)
myCommand.Parameters.Add("@content",content.text)
的顺序是
myCommand.Parameters.Add("@content",content.text)
myCommand.Parameters.Add("@title",new_title.text)
时,,,那么添加后的记录tilte 和 content 就换位了,难道@title不是类似ID的作用? 不理解~~~
补充(这个没试)
string strSql = "insert into table1 (col1,col2) values (@col1,@col2)";
SqlParameter [] Params = new SqlParameter[2];
Params[1] = new SqlParameter();
Params[1].ParameterName = "@col1";
Params[1].value = "aaron's blog";
浙公网安备 33010602011771号