Question

I'm using the wizards etc to create a c# form based application that uses a database for storage etc.

I have a customer form that currently lists all records in a datagrid.

private void frm_customer_Load(object sender, EventArgs e)
{
    this.tbl_customerTableAdapter.Fill(this.myDataSet.tbl_customer);
}

I'm hoping to filter the records.

After reading some other topics I've discovered that a Select method may be used to filter my TableAdapter. So far I have the following attached to a button.

string qString = "cust_postcode = CF48 4JY";
string oString = "cust_postcode DESC";
myDataSet.tbl_customer.Select(qString, oString);

When I hit the button it throws the following error;

"Syntax error: Missing operand after '4' operator."

I'm aware that the problem is to do with the qString itself, however I can't seem to find the correct way to do the query.

Any ideas?

Was it helpful?

Solution

Try this:

string qString = "cust_postcode = 'CF48 4JY'";
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top