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();


            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);

            dataGridView2.DataSource = cashOrdersTable;


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

Edited by sundog1: tested sql

Attachments Capture8.PNG 53.27 KB

Whats the CashAccRef declared as in the database? What type? As I assume its going to be a mismatch between what you are passing and what it expects.


Scrap that.. I'm an idiot I still had access open when trying to code out.

Still same issue. Access is set to say 'Long Number' which I am guessing is Int64 which I have changed it to but still no worky.

Edited by sundog1: st00pid


Holly F*k Nuts I did it!

All sorted.. I have the customerAccRef_FKID set to Text. Changed that to INT and its working! WH000000!!

Thanks for being patient with me Mikey! I knew I would get there in the end! :) smug

P.S = Dont go anywhere though.. I might need you help in future issues :)

Edited by sundog1


Hehe good to see you got there in the end :)!

Yeah dont' worry I won't be going anywhere, need something to pass the time at work when its quiet ;)

Edited by Mike Askew

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.