Why can't i find a Row in a dataset?

P

Paul Custance

Hi,

Currently had a Dataset that has information from the Northwind database, Customers table in it.

I have created my update and select commands and they work fine.

When I go to update a row in the data set I use this

//Get the datarow to edit
DataRow[] adrEdit = ds.Tables["Customers"].Select("CustomerID = 'txtCustomerID.Text'");

However this returns nothing, but if I do it explicitly like this

//Get the datarow to edit
DataRow[] adrEdit = ds.Tables["Customers"].Select("CustomerID = 'ALFKI'");

It works fine, why when I enter ALFKI in txtCustomerID.Text is it not making a match in the Dataset?

any help appreciated

Paul Custance
 
M

Manohar Kamath

Basically the filter is incorrect, you are not adding the text from the
customerID textbox.

DataRow[] adrEdit = ds.Tables["Customers"].Select("CustomerID = '" +
txtCustomerID.Text + "'");
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top