Passing variable to DataView

  • Thread starter Thread starter John Wildes
  • Start date Start date
J

John Wildes

Hello all

I am trying to pass a variable to a DataView so that I can filter the rows displayed in my datagrid.

Here's the code I am trying to get to work

Private Sub btnClientSearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClientSearch.Click

s_customerID = txtCustomerID.Text

MsgBox("Client ID is " + s_customerID)

daTamDataFiles.SelectCommand = cmdSelectTransactions

daTamDataFiles.Fill(dsStatementData.Transactions)

dvTransactions.RowFilter = "CustomerID = s_customerID"

End Sub

The error that I get is that s_customerID is not a row, and it isn't, it's the variable that contains some data that I want to filter the rows on, namely the customerID which is a 7 digit alpha numeric code.

dvTransactions is the dataview whose Table property is dsStatementData.Transactions

so what I am trying to do is fill the dsStatementData.Transactions table, show it in my data grid called gridTransactions using a filtered DataView. If I replace the text s_customerID with a customerID ex 'RUMSDO1' quotes and all. I get the rows filtered for that client ID.

Any help would be greatly appreciated.

John - supreme VB.net noob (pronounced 'newbie')
 
Hi,

dvTransactions.RowFilter = "CustomerID = '" + s_customerID +"'"

Ken
----------------------
Hello all

I am trying to pass a variable to a DataView so that I can filter the rows displayed in my datagrid.

Here's the code I am trying to get to work

Private Sub btnClientSearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClientSearch.Click

s_customerID = txtCustomerID.Text

MsgBox("Client ID is " + s_customerID)

daTamDataFiles.SelectCommand = cmdSelectTransactions

daTamDataFiles.Fill(dsStatementData.Transactions)

dvTransactions.RowFilter = "CustomerID = s_customerID"

End Sub

The error that I get is that s_customerID is not a row, and it isn't, it's the variable that contains some data that I want to filter the rows on, namely the customerID which is a 7 digit alpha numeric code.

dvTransactions is the dataview whose Table property is dsStatementData.Transactions

so what I am trying to do is fill the dsStatementData.Transactions table, show it in my data grid called gridTransactions using a filtered DataView. If I replace the text s_customerID with a customerID ex 'RUMSDO1' quotes and all. I get the rows filtered for that client ID.

Any help would be greatly appreciated.

John - supreme VB.net noob (pronounced 'newbie')
 
Ken

Thanks much, going forward, is this how I would reference variables in properties like this ?

john

Hi,

dvTransactions.RowFilter = "CustomerID = '" + s_customerID +"'"

Ken
----------------------
Hello all

I am trying to pass a variable to a DataView so that I can filter the rows displayed in my datagrid.

Here's the code I am trying to get to work

Private Sub btnClientSearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClientSearch.Click

s_customerID = txtCustomerID.Text

MsgBox("Client ID is " + s_customerID)

daTamDataFiles.SelectCommand = cmdSelectTransactions

daTamDataFiles.Fill(dsStatementData.Transactions)

dvTransactions.RowFilter = "CustomerID = s_customerID"

End Sub

The error that I get is that s_customerID is not a row, and it isn't, it's the variable that contains some data that I want to filter the rows on, namely the customerID which is a 7 digit alpha numeric code.

dvTransactions is the dataview whose Table property is dsStatementData.Transactions

so what I am trying to do is fill the dsStatementData.Transactions table, show it in my data grid called gridTransactions using a filtered DataView. If I replace the text s_customerID with a customerID ex 'RUMSDO1' quotes and all. I get the rows filtered for that client ID.

Any help would be greatly appreciated.

John - supreme VB.net noob (pronounced 'newbie')
 
hi,

Yes.

Ken
----------------
Ken

Thanks much, going forward, is this how I would reference variables in properties like this ?

john

Hi,

dvTransactions.RowFilter = "CustomerID = '" + s_customerID +"'"

Ken
----------------------
Hello all

I am trying to pass a variable to a DataView so that I can filter the rows displayed in my datagrid.

Here's the code I am trying to get to work

Private Sub btnClientSearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClientSearch.Click

s_customerID = txtCustomerID.Text

MsgBox("Client ID is " + s_customerID)

daTamDataFiles.SelectCommand = cmdSelectTransactions

daTamDataFiles.Fill(dsStatementData.Transactions)

dvTransactions.RowFilter = "CustomerID = s_customerID"

End Sub

The error that I get is that s_customerID is not a row, and it isn't, it's the variable that contains some data that I want to filter the rows on, namely the customerID which is a 7 digit alpha numeric code.

dvTransactions is the dataview whose Table property is dsStatementData.Transactions

so what I am trying to do is fill the dsStatementData.Transactions table, show it in my data grid called gridTransactions using a filtered DataView. If I replace the text s_customerID with a customerID ex 'RUMSDO1' quotes and all. I get the rows filtered for that client ID.

Any help would be greatly appreciated.

John - supreme VB.net noob (pronounced 'newbie')
 
Back
Top