0

I am creating a web app with mvc-5 angularJS.
I have two tables in my sql, in my first table I have multiple data's

employee table

date         name            job          sonvinid
10-10-2013   Ibibo           asp.net           1
10-10-2014   nizam           asp.net           2 
10-10-2015   fawzan          asp.net           3
10-10-2016   savio           asp.net           4
10-10-2017   kailash         asp.net           5
10-01-2016   vaibhav         asp.net           6

in my second table(training) I don't have any data, but the table look like this:

date name job sonvinid

so in my web app I have 2 textboxes (datefrom & dateto)
and as per date, data will be shown in the table

<tr ng-repeat="fdata in getdataintable">
                        <td><a href="#" class="btn btn-success" ng-click="btndetails(fdata)" style="cursor: pointer" data-toggle="modal" data-target="#myModal">Details</a></td>
                        <td>{{fdata.sonvinid}}</td>
                        <td>
                            <input type="checkbox" ng-checked="checkall" ng-model="fdata.checked" data-ng-click="calculateTotal(fdata)" /></td>
                    </tr>

and as you can see, I have one checkbox also, and I have another checkbox in my <th>named

<th>
  <input type="checkbox" ng-click="allcheck()" ng-model="checkall" /><span style="margin-left: 10px;">Add Invoice</span>
</th>

if I check this, all the data will be checked, now what I want to do is, for example if I checked(checkall), and uncheck first two records i.e(sonvinid=1 & sonvinid=2) whole data should be inserted in my table 2 except where sonvin id=1 and 2 and as you see, there is only sonvinid in my table,
first I want to do is call whole column with select command then secondly I want to insert that into my second table with where clause.

how I can do this?

(call the table with date range, and insert the data into another table with where clause)

2
  • You can use the same parameter getdataintable to populate data to another table as well.
    – Snopzer
    Jan 18, 2017 at 7:26
  • All you have to do is to pass the list of sonvinid (which I am assuming is unique in the employee table) of the records that are checked in the table to the database, and then use a simple insert...select to insert the records from one table to the other. What part of this are you having problems with? Jan 18, 2017 at 7:58

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.