Hello Everyone... Long time reader, first time poster. I must say, I have learned so much from this forum, and I thank you all. I have a form that I will be entering info about the pieces of music I write, and they will be saved into a MySQL database on another machine. I can connect to the database just fine. I am trying to create a button on the form that will insert the info on the form into the database:

model->insertRecord(-1, rec);

Would I have to create a seperate header file, or could I create this in the main.cpp? I tried adding a Submit Button like these two ways, but both did not work:

QPushButton *submitButton = new QPushButton("Submit");
QObject::connect(submitButton, SIGNAL(clicked()), &app, SLOT(model->insertRecord(-1, rec)));
or
QPushButton *submitButton = new QPushButton("Submit");
QObject::connect(submitButton, SIGNAL(clicked()), &app, SLOT(exec(model->insertRecord(-1, rec))));

If I put that directly into the code like this:
QSqlTableModel *model = new QSqlTableModel;
model->setTable("main");
QSqlRecord rec;
rec.append(QSqlField("piece_name", QVariant::String));
rec.append(QSqlField("status", QVariant::String));
rec.setValue("piece_name", pieceNameLineEdit->text());
rec.setValue("status", statusComboBox->currentText());
model->insertRecord(-1, rec);
it will create a new record with nothing in the piece_name field, and "In Progress" in the status field.

Any advice would be very much appreciated.

Brian
QT 4 on Windows XP