Skip to content

Infragistics Community Forum / Cross Platform / Ultimate UI for Xamarin / DataTable has Multiple Primary Keys

DataTable has Multiple Primary Keys

New Discussion
Geoffrey
Geoffrey asked on Apr 22, 2009 2:34 PM

is this supported? or do i have to create a third PK in the app only?

tia.

Sign In to post a reply

Replies

  • 0
    Andrej Kuklin
    Andrej Kuklin answered on Feb 26, 2008 4:01 PM

    1. DataTable.PrimaryKey is a unique property of the datatable (i.e. there is only one primary key, and that's all. The same concept is used in the databases BTW).

    2. May be you meant UniqueConstraint http://msdn2.microsoft.com/en-us/library/system.data.uniqueconstraint.aspx ?

    3. This are ADO.NET things. What does this have to do with Infragistics components?

    • 0
      Geoffrey
      Geoffrey answered on Feb 26, 2008 4:11 PM

      I am binding a webgrid to a sharepoint datatable and allowing the user to update a document list via the webgrid.

      Let us consider the following example code:

      tbl = ds.Tables.Add("Order Details");
      tbl.Columns.Add("OrderID", typeof(int));
      tbl.Columns.Add("ProductID", typeof(int));
      tbl.PrimaryKey = new DataColumn[ {tbl.Columns["OrderID"],
                                         tbl.Columns["ProductID"]}; 

      … is this supported in the ultrawebgrid?

      I have reviewed source samples eg. UltraWebGrid1.Bands[0].DataKeyField=dataSet11.Tables[ParentTable].PrimaryKey[0].ColumnName;

      this example does not provide for multiple keys .. any thoughts?

      tia.

       

      • 0
        Geoffrey
        Geoffrey answered on Feb 26, 2008 5:00 PM

        I found the anwer …

        .DisplayLayout.Bands(0).DataKeyField = "OrderId, ProductID"

        would produce the desired two column key relationship in the webgrid.

         Dim key_row() As Object = e.Cell.Row.DataKey

        table = dsList.Tables(e.Cell.Band.BaseTableName)

        row = table.Rows.Find(key_row)

        would allow you to find the key.

      • 0
        Darrell Kress
        Darrell Kress answered on Feb 28, 2008 4:17 AM

         The DataKeyField off the Band takes a string of column names, comma delimited.

         

        .DataKeyField = "OrderID, ProductID"; 

      • 0
        Adam
        Adam answered on Apr 22, 2009 2:34 PM

        In NetAdvantage 2009 Volumn 1, this doesn't work
        If I use this format, those AddRow, UpdateRow, DeleteRow events won't fire.

        Could anyone provide a workable solution? All of my grids build upon 2008 vol 3 are failed…

  • You must be logged in to reply to this topic.
Discussion created by
Favorites
Replies
Created On
Last Post
Discussion created by
Geoffrey
Favorites
0
Replies
5
Created On
Apr 22, 2009
Last Post
16 years, 10 months ago

Suggested Discussions

Created by

Created on

Apr 22, 2009 2:34 PM

Last activity on

Apr 22, 2009 2:34 PM