ive been told to put all my sql statement together but i jus keep getting lots of errors with local variables in my vc++ project.
sql.h
#ifndef __SQL_H__
#define __SQL_H__
#include "stdafx.h"
#include <iostream>
#include <string>
using namespace std;
using namespace System::Data::SQLite;
using namespace System::Data;
using namespace System::Windows::Forms;
using namespace System;
class sql
{
public:
void click(Label ^label1);
void worknow(TextBox ^textBox1);
//not working
};
#endif
my cpp file:
#include "stdafx.h"
#include "sql.h"
#include <string>
using namespace System;
using namespace System::Data::SQLite;
using namespace System::Data;
using namespace System::Windows::Forms;
void sql::click(Label ^label1) {
SQLiteConnection^ ObjConnection = gcnew SQLiteConnection("Data Source=database.db3;");
SQLiteCommand^ ObjCommand = gcnew SQLiteCommand("SELECT * FROM employee", ObjConnection);
ObjCommand->CommandType = CommandType::Text;
SQLiteDataAdapter^ ObjDataAdapter = gcnew SQLiteDataAdapter(ObjCommand);
DataSet^ dataSet = gcnew DataSet();
ObjDataAdapter->Fill(dataSet, "employee");
label1->DataBindings->Add("Text", dataSet->Tables["employee"],"firstname");
}
void sql::worknow(TextBox ^textBox1) {
SQLiteConnection^ ObjConnection = gcnew SQLiteConnection("Data Source=database.db3;");
SQLiteCommand^ ObjCommand = gcnew SQLiteCommand("DELETE FROM employee WHERE id = ('"+worked+"')", ObjConnection);
ObjCommand->CommandType = CommandType::Text;
SQLiteDataAdapter^ ObjDataAdapter = gcnew SQLiteDataAdapter(ObjCommand);
DataSet^ dataSet = gcnew DataSet();
ObjDataAdapter->Fill(dataSet, "employee");
also have a windows form which am going to call the method:
button click.....
sql cmd
cmd2.worked(textBox1,);
my error output:
sql.cpp(28) : error C2065: 'worked' : undeclared identifier