I am fairly new to C# and just as new to Visual Studio and am working on a project for personal development. I am following the instructions at the following page to set up a connection from a windows form to the database:
How to: Create and Execute an SQL Statement that Returns Rows
I have a DB called Taxdb, table called Federal, and I created a table adapter called Federal1.TableAdapter. (Original, I know.) I went through the wizard to create a query, and called it GetFedSingle. So when I got to the part where I put code in the form, I thought it would be a slam dunk by putting this line of code in:
TaxdbDataSetTableAdapters.Federal1TableAdapter tableAdapter = new TaxdbDataSetTableAdapters.Federal1TableAdapter();
TaxdbDataSetTableAdapters.Federal1TableAdapter.GetFedSingle();
However, the two errors I am getting are these:
Invalid token '(' in class, struct, or interface member declaration
'Tax3.TaxdbDataSetTableAdapters.Federal1TableAdapter.GetFedSingle(Tax3.TaxdbDataSet.Federal1DataTable)' is a 'method' but is used like a 'type'
I put this code as the first line of the meat of the form code, above the variable definitions:
namespace Tax3
{
public partial class TaxResults : Form
{
TaxdbDataSetTableAdapters.Federal1TableAdapter tableAdapter = new TaxdbDataSetTableAdapters.Federal1TableAdapter();
TaxdbDataSetTableAdapters.Federal1TableAdapter.GetFedSingle();
I'm sure I am forgetting something really stupidly easy. Does anyone have any suggestions?
How to: Create and Execute an SQL Statement that Returns Rows
I have a DB called Taxdb, table called Federal, and I created a table adapter called Federal1.TableAdapter. (Original, I know.) I went through the wizard to create a query, and called it GetFedSingle. So when I got to the part where I put code in the form, I thought it would be a slam dunk by putting this line of code in:
TaxdbDataSetTableAdapters.Federal1TableAdapter tableAdapter = new TaxdbDataSetTableAdapters.Federal1TableAdapter();
TaxdbDataSetTableAdapters.Federal1TableAdapter.GetFedSingle();
However, the two errors I am getting are these:
Invalid token '(' in class, struct, or interface member declaration
'Tax3.TaxdbDataSetTableAdapters.Federal1TableAdapter.GetFedSingle(Tax3.TaxdbDataSet.Federal1DataTable)' is a 'method' but is used like a 'type'
I put this code as the first line of the meat of the form code, above the variable definitions:
namespace Tax3
{
public partial class TaxResults : Form
{
TaxdbDataSetTableAdapters.Federal1TableAdapter tableAdapter = new TaxdbDataSetTableAdapters.Federal1TableAdapter();
TaxdbDataSetTableAdapters.Federal1TableAdapter.GetFedSingle();
I'm sure I am forgetting something really stupidly easy. Does anyone have any suggestions?