locked
Unable to select multiple column in datatable (dtable.select()) RRS feed

  • Question

  • User983825434 posted

    Hi Guys
    Unable to select multiple column in datatable

    Code:
    Dim Activitydtb As DataTable = DirectCast(ViewState("TalentcharacterActivty"), DataTable)
    grdviewactivity.DataSource = Activitydtb.Select("SELECT ID,Activeval,startdate,enddate PKID ='" & smp & "'", Nothing)

    grdviewactivity.DataBind()

    Example table format:

    ID,PKID,activalue,startdate,end date

    Please give some suggestion

    Thanks
    Ranganathan Palanisamy

    Tuesday, August 2, 2011 11:08 AM

Answers

  • User896700311 posted

    Hi,

    try:

    grdviewactivity.DataSource = Activitydtb.Select("PKID ='" & smp & "'", Nothing)

    Any doubt, post your comment.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, August 2, 2011 2:13 PM
  • User-578657687 posted

    Hi,

    The post above is correct.

    The DataTabel.Select method gets the an array of DataRow of table. And its parameter is an expression not select statement. More information and sample code please check this:

    http://msdn.microsoft.com/en-us/library/system.data.datatable.select.aspx

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, August 9, 2011 1:24 AM

All replies

  • User896700311 posted

    Hi,

    try:

    grdviewactivity.DataSource = Activitydtb.Select("PKID ='" & smp & "'", Nothing)

    Any doubt, post your comment.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, August 2, 2011 2:13 PM
  • User-578657687 posted

    Hi,

    The post above is correct.

    The DataTabel.Select method gets the an array of DataRow of table. And its parameter is an expression not select statement. More information and sample code please check this:

    http://msdn.microsoft.com/en-us/library/system.data.datatable.select.aspx

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, August 9, 2011 1:24 AM