Results 1 to 9 of 9

Thread: checkbox with SQL server

  1. #1
    Join Date
    Feb 2003
    Posts
    62

    checkbox with SQL server

    Can you tell me how to use the checkbox so that I can insert a value of -1 into the table when it is selected and 0 when not? I have tried the following:

    .dbEditUpdateFlds="field=regComplete|type=checkbox +B"

    If I make the field type nvarchar I get the following: true when the checkbox is selected and 0 when it's not. I get an error if I change the type to `bit'

    Bob

  2. #2
    Join Date
    Oct 2002
    Posts
    933
    you mean a true/false? the 0/-1 is different for Access and SQL. that is why you can set it in dbBooltext.

    FK

  3. #3
    Join Date
    Feb 2003
    Posts
    62
    I have added the line .dbBoolText="Droptrue=-1|Dropfalse=0" and changed the field type to `bit'. The zero goes in fine but when I select the checkbox I get the error:

    `Invalid column name true' etc

  4. #4
    Join Date
    Oct 2002
    Posts
    933
    `Invalid column name true'
    This msg does not look right!

    Give me a few lines of code...

    FK

  5. #5
    Join Date
    Feb 2003
    Posts
    62
    Frank

    Give me a couple of days and I'll send you a Northwind sample

  6. #6
    Join Date
    Oct 2002
    Posts
    933
    I found this example in my folder. Try it !

    FK

    <script language='vb' runat='server'>
    Sub Page_Load(Source as Object, E as EventArgs)
    Dim Mydb As New Tornado.Z()
    With Mydb
    .dbQP = "U=2| M=Grid| S=plain| D=fkw;northwind;sa;sa| Q=SELECT * From products| TextHolder=Title=Bit Field Demo|ni=b5,update|bm=products;0| gdf=0,1,2,3,discontinued"
    .dbEditUpdateflds="Fi=0|ty=RONOUPDATE, fi=Discontinued| ty=CheckBox"
    .dbBoolText="DropTrue=1|DropFalse=0"
    .ASPdbNET()
    End With
    End Sub
    </script>

  7. #7
    Join Date
    Feb 2003
    Posts
    62
    Frank

    I think my dll may be out of date or something - when I run your sample and update the checkbox I get:

    System.Data.OleDb.OleDbException: Invalid column name 'true'. at System.Data.OleDb.OleDbDataReader.NextResults(IMul tipleResults imultipleResults, OleDbConnection connection, OleDbCommand command) at System.Data.OleDb.OleDbCommand.ExecuteReaderIntern al(CommandBehavior behavior, String method) at System.Data.OleDb.OleDbCommand.ExecuteNonQuery() at Tornado.Edit.Action_Edit_Execute_SQL(String sql, String which, Int32 recs)

  8. #8
    Join Date
    Oct 2002
    Posts
    933
    that must be the reason.. go download the latest...

  9. #9
    Join Date
    Feb 2003
    Posts
    62
    Downloaded latest dll and used your sample code - it's working fine. Thanks

Posting Permissions

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