c# - using foreach and multiple insert rows? -


I'm a newbie from C # and I am currently using C # vs 2013 and MS Access database. I'm trying to do Mulitple insertion and trying to foreach at the same time .. I have 2 tablets in the entry

The first table

  EID ----- - First Name 10175-- Random Name 10176-- Random Name 10177-- Random Name 10178 - - Random Name 10179 - Random Name 10180 - Not Random I   

second table

  index --- EID ----- date (index is automon type) 1----- - 10175 ---- 10/10/2014 2 -------0175 ---- 10/11/2014 3 ------- 10175 ---- 10/12/2014 4 - ------ 10175 ---- 10/13/2014 5----- 10175 ---- 10/14/2014 6 ------- 10175 ---- 10/15 / 2014 7 ------- 10175 ---- 10/16 / 2014 8 ------- 10175 ---- 10/17/2014 9 ------- 10175 --- - 10/18/2014 10 ------ 10175 ---- 10 / 10/2014   

What should I do when I clicked on a button then I was the first I want to insert 10 record dates on table 2 for each ed on table..my code is 10175 Area Loop 10 record

  connection.Open (for); Olebey Commands Command = New OLEDB Commands (); order. Connection = connection; Int ctr = 0; Int counter; Counter = int.Parse (TimeIntxt.Text); // I just use the textbox for testing, I want to be autogenerate it based on the number of EIDs on the first table string counter 2; (CTR = 0; CTR & lt; 10; ctr ++) for {counter ++; Counter 2 = Datetime Picture 1. Value Additions (CTR + 1) .ostring (); Command10.CommandText = "Enter the employee data (EID, date in) values ​​('+ + + +' ','" + 2 counter + 2 "); Command10.ExecuteNonQuery (); } MessageBox.Show ("successfully created"); Connection.Close ();   


Thank you very much for people who help me .. forgive me if my english is not really fluent

  connection.Open () OleDBCommand command = new OleDbCommand (); order. Connection = connection; Command.CommandText = "Select from the table EID"; (Enter the new connection {//} for OleDbDataReader dr = command.ExecuteReader ()) {while (dr.read ()) {// (var i = 0; i & lt; 10; i ++) ["EID"] in Table 2}}}    

Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -