Results 1 to 2 of 2

Thread: Dataset and searching non primary key columns.

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2003
    Posts
    9

    Question Dataset and searching non primary key columns.

    Hi Agian,

    I have a a question and it has to do with searching a column that is not primary key in a MS Access DB.

    Today this is all I know....I know its sad, but I'm working on it.

    ------------------------------------------------------------------------------------
    objDataSet.Clear()
    objDA_bdg_Bank.FillSchema(objDataSet, SchemaType.Mapped, "bdg_Bank")
    objDA_bdg_Bank.Fill(objDataSet, "bdg_Bank")

    Dim objRow As DataRow

    objRow = objDataSet.Tables("bdg_Bank").Rows.Find(cboBankName.Text)
    ------------------------------------------------------------------------------------

    This table has the following columns:

    bdg_BankId = (Primary Key)
    bdg_BankName = cboBankName (Unique)

    Unfortunatly VB doesn't allow me to search column bdg_BankName as it's not the Primary Key because I use .Find

    So how can I search for an example bdg_BankName but return the value of bdg_Bank_Id

    Doing this in SQL would look like this:

    Select bdg_BankId
    From bdg_Bank
    Where bdg_BankName = "String"

    Would be so much easier if one could use SQL statements to execute search criteria's.

    Thank you for listening.

    Claudio

  2. #2
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    You can get a set of filtered datarows by using the Select method:
    VB Code:
    1. Dim objRow() As DataRow = objDataSet.Tables("bdg_Bank").Rows.Select("FieldName='FieldValue'")

Posting Permissions

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



Click Here to Expand Forum to Full Width