Skip to content
Permalink
a1b7e58de1
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
31 lines (30 sloc) 813 Bytes
#ifndef INSERT1_DB_H
#define INSERT1_DB_H
#include <iostream>
#include "select_db.h"
#include "libsqlite.hpp"
using namespace std;
int insert1_db(int studentID, string modules, string classes, string lecturers, string room, int startTiming, int endTiming)
{/*insert the student details into database*/
try{
sqlite::sqlite db("Timetable.db");
auto cur = db.get_statement();
cur->set_sql( "INSERT INTO Work VALUES(?,?,?,?,?,?,?);" );
cur->prepare();
cur->bind( 1, studentID );
cur->bind( 2, modules );
cur->bind( 3, classes );
cur->bind( 4, lecturers );
cur->bind( 5, room );
cur->bind( 6, startTiming );
cur->bind( 6, endTiming );
cur->step();
}
catch( sqlite::exception e )
{
cerr << e.what() << endl;
return 1;
}
return 0;
}
#endif