Click here to Skip to main content
15,914,014 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
database table 1 have field like, id,cnm,mn,addr,amnt,disc.

Now form1 insert their data in table 1 (cnm.mn,addr)
and when form 2 inserted their data in table 1(amnt,disc), that time that data will added within form 1 entry data in ms access.

so when form1 insert data in table 1 database, like id =1, cnm=abc, mn=123,addr=xyz,amnt=,disc=.

amnt and disc value inserted after form 2 data insert in table 1 then.
like id =1, cnm=abc, mn=123,addr=xyz,amnt=1000,disc=100.

What I have tried:

I have trying to Insert two forms of data in one table of MS Access Database. If any one known the Queries of it then please help me.

Suppose form 1 have customer_name,Mobile,Address and form 2 have Amount,Discount of the customer which name is added in form 1.

database table 1 have field like, id,cnm,mn,addr,amnt,disc.

Now form1 insert their data in table 1 (cnm.mn,addr)
and when form 2 inserted their data in table 1(amnt,disc), that time that data will added within form 1 entry data in ms access.

so when form1 insert data in table 1 database, like id =1, cnm=abc, mn=123,addr=xyz,amnt=,disc=.

amnt and disc value inserted after form 2 data insert in table 1 then.
like id =1, cnm=abc, mn=123,addr=xyz,amnt=1000,disc=100.
Posted
Updated 5-Oct-18 19:24pm
Comments
Richard MacCutchan 30-Sep-18 11:00am    
Collect the data from both forms (why do you need two?), and then add the information to the database.

1 solution

C#
public static class GLOBALVARS
    {
        public static DataTable dt;

    }


C#
if (GLOBALVARS.dt.Columns.Count == 0)
         {
             GLOBALVARS.dt.Columns.Add("id");
             GLOBALVARS.dt.Columns.Add("cnm");
             GLOBALVARS.dt.Columns.Add("addr");
             GLOBALVARS.dt.Columns.Add("disc");
         }

         DataRow dr = GLOBALVARS.dt.NewRow();

         dr["id"] = 1;
         dr["cnm"] = "abc";
         dr["addr"] = "xyz";
         dr["disc"] = 100;

         GLOBALVARS.dt.Rows.Add(dr);


Now store data to table.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900