Friday, December 28, 2012

What is difference between unique key and primary key?


There is two difference between them.
1. The not null constraint is by default added to primary key, it means, primary key attribute cannot accept null values, whereas, the attribute declared as unique can accept null values. It is the major difference between the two.
2. Secondly, we can have only one primary key in a relation, whereas, multiple attributes can be declared unique at the same time.

Friday, December 7, 2012

Binding Checked List box control with data


        CheckedListAccount.DataSource = Dset.Tables(0) ' Dataset containing datatable

        CheckedListAccount.DisplayMember = "account_name" 'display field
        CheckedListAccount.ValueMember = "account_id"        'id filed

'to get selected items id from checked list box


        For Each checkeditem As DataRowView In CheckedListAccount.CheckedItems
            MsgBox(checkeditem.Item("account_id").ToString())
        Next