Hi, I am trying to build a simple program that keeps track of a list of print cartridges.
I am using C# express and SQL server express.
I have a query called 'Insert Query' which when I run it in the SQL wizard returns the correct rows.
However when I then attempt to integrate the query into the code as I have with many of my other queries I get the following error.
'No overload for Method 'InsertQuery' takes '1' argument'
My code looks like this
this.ordersTableAdapter.InsertQuery(this.orderDataSet.Orders);
This code is on a secondary form to my main form if that makes any difference?
Am I doing something very dopey here? Any help appreciated
Thanks
Loading
Sam HobbsPosted Nov 3, 2009, 7:07 PM
What happens when you hover over the "InsertQuery"? It should show what the type it is expecting. Something else to try is to right-click on InsertQuery and select "Go To Definition". Hopefully at least one of those two ways will tell you what to use as the parameter(s).
How many columns are in the table? If the InsertQuery is actually an insert command, then it might need as many parameters as there are columns, one for each column. Otherwise my guess (and this really is a guess) it might need a DataRow.
So if you can get Visual Studio to tell us what the parameter(s) should be, it should be easy to figure out.
EdwardPosted Nov 3, 2009, 1:30 PM
I have another table called 'stock' which I guess is why it won't let me just put the table name as it needs to distinguish between the two.
Any other thoughts appreciated.
Posted Nov 3, 2009, 12:32 PM
this.ordersTableAdapter.InsertQuery(this.orderDataSet.Orders);
No need to give in this way.Just give the name of the table..For example if the table name is employee
this.ordersTableAdapter.InsertQuery(employee);
Hope this helps...
If my answer helped u in someway don't forget to mark it as correct answer