环境 VS2010 + SQL2000<%@ Page Language="C#" AutoEventWireup="true" CodeFile="admin_system.aspx.cs" Inherits="admin_system" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"> <td width="20%" align="right">IP限制:</td>
            <td><select name="RestrictIP" size="1" id="RestrictIP">
                <option <%=RestrictIP("true")%> value="true" > 是</option>
                <option <%=RestrictIP("false")%> value="false"> 否</option>
              </select>
              <span>选择“是”则不允许同一IP多次投票</span></td>
          </tr>SQL2000 表名config 列名 resip 数据类型 bit public string RestrictIP(string bRestrict)
    {
        if (cfg.getRestrictIP().ToString().Trim().ToLower() == bRestrict.Trim().ToLower())
        {
            return "1";
        }
        else
        {
            return "0";
        }    }
connection.Open();
string sql ="update config set resip='" + Request["restrictIP"] + "'";
SqlCommand OleCmd = new SqlCommand(sql, connection);
OleCmd.ExecuteNonQuery();
connection.Close();SQL2000 bit数据类型只能写入0/1 吧, 我现在就提示将varchar值 'False'转换为数据类型为bit的列时发生语法错误 好象我读取的是 ture/false请问如何写入 正确的 0/1呢?