I am trying to archive a datagrid into a datatable so I can find it in the table by the archive date. I am using an INSERT SQL statement as follows:
INSERT INTO [VendorArchive] ([Booth], [Deposit], [Rent], [Electric], [Security],
[AmountPaid], [DatePaid], [PeriodPaid], [TotalDue], [Notes], [ArchiveDate],
[BalanceDue], GETDATE());
SELECT Booth, Deposit, Rent, Electric, Security AmountPaid, DatePaid, PeriodPaid,
TotalDue, BalanceDue, Notes
FROM Vendors
I then call the sql function in my code inside a button click event:
private void vendorArchiveToolStripButton_Click(object sender, EventArgs e)
{
if (MessageBox.Show("Are you sure you wish to archive?", "Perform Archive", MessageBoxButtons.YesNo) == DialogResult.Yes)
{
vendorArchiveTableAdapter.PerformArchive();
MessageBox.Show("Archive has completed.");
}
}
When i debug and hit the archive button I get this error: “No overload for method ‘PerformArchive’ takes 0 arguments”
I don’t understand. Am I using the wrong SQL statement? Do I need to add all the columns as argumnets in the method call?
Please help.
Your SQL query is wrong but the specific error you get has nothing to do with your SQL query.
Somewhere in your project you have a method called
PerformArchiveand this method takes at least one parameter. You need to provide a value for that parameter.Assuming you are using Visual Studio, put the cursor on the method name and press F12 to go to the definition and then you can see what the parameters are.
Regarding your SQL you need something like this:
Errors that I have fixed:
SecurityandAmountPaid.