setting a value to true in a bit field

Results 1 to 2 of 2

Thread: setting a value to true in a bit field

  1. #1
    PJ Guest

    Default setting a value to true in a bit field

    Does anyone know why the following would NOT set a bit field value to true in SQL Server? (Assume id 1 is present)<BR><BR>Set conn = Server.CreateObject("ADODB.Connection")<BR>conn = "PROVIDER=MSDASQL;DRIVER={SQL Server};SERVER=111.222.333.444;DATABASE=db;UID=uid ;PWD=pwd;"<BR>Set rs = Server.CreateObject("ADODB.Recordset")<BR>sql = "SELECT approved FROM table WHERE id = 1"<BR>rs.Open sql, conn, 1, 3<BR>rs("approved") = 1<BR>rs.Update<BR>rs.Close<BR>Set rs = Nothing<BR><BR>The field in SQL Server is set to bit. This has not been a problem before. My update actually includes many more fields, some of which I redisplay on the page. I just wanted to make this operation clear by leaving them out. All the fields get updated, so I know it&#039s finding the record. It&#039s just not changing the value for &#039approved.&#039 <BR><BR>I can&#039t help but think I&#039m overlooking something way fundamental. Any ideas?<BR><BR>Thanks,<BR>PJ

  2. #2
    David Forster Guest

    Default RE: setting a value to true in a bit field

    This is just a guess because I haven&#039t got time to test it out, but try putting the 1 in quotes as if it were a string. i.e<BR><BR>rs("approved") = "1"<BR><BR>SQL Server SHOULD realise what is going on and change your bit field.<BR><BR>Hope this helps,<BR>D.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts