Hi Mikey,
I think i'm a lot closer to geting where I need to be.. I have setup the following code below:
private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
{
DataGridViewRow row = dataGridView1.SelectedRows[0];
//int CustomerID = Convert.ToInt32(row.Cells[0].Value);
string CustomerID = row.Cells[0].Value.ToString();
cashCustom.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:/Orders.mdb";
cashOrdersDS = new DataSet();
cashOrdersTable = new DataTable();
cashOrdersDS.Tables.Add(cashOrdersTable);
cashCustom.Open();
cashCustom.Close();
String cashOrdersSQL = "SELECT * FROM cashOrders INNER JOIN cashCustomers ON cashOrders.cashAccountRef_FKID=cashCustomers.CashAccRef WHERE cashCustomers.CashAccRef = " + CustomerID;
cashDA = new System.Data.OleDb.OleDbDataAdapter(cashOrdersSQL, cashCustom);
cashDA.Fill(cashOrdersTable);
dataGridView2.DataSource = cashOrdersTable;
dataGridView2.Columns.Remove("ID");
dataGridView2.Columns.Remove("cashAccountRef_FKID");
MessageBox.Show(CustomerID.ToString());
}
When stepping through it I can physically see the CustomerID field being picked up and then it steps through until it errors at "cashDA.Fill(cashOrdersTable);"
I don't know if it's someting to do with the CustomerID being declared as an INT or a string (tried both an same error)
Error is in Screenshot.
I can smell victory in this problem!
P.S. = Just Checked the SQL Command in Server Studio and works fine