SQL的删除问题 在SQL Server中,删除是这样的:
DECLARE @sql varchar(8000)
SET @sql='delete from members where member_id in ('+@_ids+')'
EXEC(@sql)
在c#中定义参数就可以了:
OleDbParameter _param = new OleDbParameter("@_ids", OleDbType.LongVarChar);
在Access中为什么不行?
string sql="delete from members where member_id in (@_ids)";
OleDbParameter _param = new OleDbParameter("@_ids", OleDbType.LongVarChar);
另:
string sql="delete from members where member_id in ("+_ids+")";
这种方式不要
string sql="delete from members where member_id in (?)";
OleDbConnection Conn = new OleDbConnection(strConnection);
Conn.Open();
OleDbCommand command=new OleDbCommand(sql,Conn);
command.Parameters.AddWithValue("?", OleDbType.LongVarChar).Value = 你的参数值;
command.ExecuteQuery();
Conn.Close(); ------解决方案-------------------- 在Access中为什么不行?
string sql="delete from members where member_id in (@_ids)";
OleDbParameter _param = new OleDbParameter("@_ids", OleDbType.LongVarChar);