Click here to Skip to main content
15,885,622 members
Please Sign up or sign in to vote.
1.33/5 (3 votes)
See more:
I have make below fuction which update NoOfSoldShares in Stock Entry.
this function work perfectly in 32 bit system,
but in 64 bit system NoOfSoldShares not update.

becoz of some 64 bit related issue this function not working,
but i have not 64 bit system to check for problem...

so please help me for issue...if any one has idea about this...

What I have tried:

public static void UpdateStockEntry()
        {
            try
            {
                string Query = "select concat('C',CompanyCode,myear,'SHARE_MKT')  AS Databasename,CompanyCode,myear \n" +
                    "from yearmaster y inner join  companymaster c on y.CompanyAuto=c.autotrno order by myear,CompanyCode asc";
                DataTable database = Program.GetDataTable(Query, Program.SysConn);
                DataTable SysDB = Program.GetDataTable("Select DISTINCT TABLE_SCHEMA  from information_schema.TABLES where TABLE_SCHEMA like '%SHARE_MKT%' ", Program.Conn);
                if (database.Rows.Count > 0)
                {
                    for (int j = 0; j < database.Rows.Count; j++)
                    {
                        string Databasename = database.Rows[j]["Databasename"].ToString();
                        SysDB.DefaultView.RowFilter = "";
                        SysDB.DefaultView.RowFilter = "TABLE_SCHEMA='" + Databasename + "'";

                        if (SysDB.DefaultView.Count > 0)
                        {
                            decimal DbYear = decimal.Parse(database.Rows[j]["myear"].ToString());
                            decimal PrevYear = DbYear - 1;

                            //string CurrYear = Program.ToDate.Year.ToString();
                            string PrevDatabasename = Databasename.Replace(DbYear.ToString(), PrevYear.ToString());
                            SysDB.DefaultView.RowFilter = "";
                            SysDB.DefaultView.RowFilter = "TABLE_SCHEMA='" + PrevDatabasename + "'";

                            if (SysDB.DefaultView.Count > 0)
                            {
                                 Program.Execute("update " + Databasename + ".StockEntry s\n" +
                                 ", " + PrevDatabasename + ".StockEntry sb\n" +
                                 "set s.OpeningIssueShare=ifnull(sb.NoofSoldShares,0)\n" +
                                 "where sb.autotrno=s.autotrno", Program.Conn);
                            }

                            if (Databasename != "")
                            {
                                Program.Execute("update " + Databasename + ".StockEntry set NoofSoldShares=ifnull(OpeningIssueShare,0)", Program.Conn);

                                Program.Execute("update " + Databasename + ".StockEntry s\n" +
                               ",(select AgainstAuto,sum(SubQty) SubQty from " + Databasename + ".salesentrysub group by AgainstAuto) sb\n" +
                               "set NoofSoldShares=ifnull(NoofSoldShares,0)+ifnull(SubQty,0)\n" +
                               "where sb.AgainstAuto=s.autotrno", Program.Conn);
                            }
                        }
                    }
                }
            }
            catch (Exception)
            {
                //throw;
            }
        }
Posted
Updated 19-Apr-17 22:17pm
Comments
CHill60 20-Apr-17 4:31am    
What is Program? (And your code appears to be vulnerable to SQL Injection attacks)
How do you know it's a 64bit problem and not some other issue with your installation (such as the connection string, location of database etc)
pt1401 20-Apr-17 4:43am    
I'm guessing your solution is targeting 'x32' instead of 'AnyCPU' ?
Member 9720862 20-Apr-17 5:07am    
in 32 bit its working and in 64 bit its not working...so it is 64 bit machine related issue.. i am sure for that..
Richard MacCutchan 20-Apr-17 5:38am    
Then please present your evidence, explaining exactly where the error occurs.
[no name] 20-Apr-17 8:43am    
Perhaps if you stop ignoring exceptions you would discover what "not working" means. We have no idea what you think not working means.

1 solution

Hello,
only to be sure: are you compiling 64bit on a 32bit machine? If so just make sure that x64 bit compilers are installed on your 32-bit machine because they're not installed by default
 
Share this answer
 
Comments
Member 9720862 20-Apr-17 5:05am    
no i compiling 64bit on 64 bit machine.
Alessio.NET 21-Apr-17 4:17am    
You said "but i have not 64 bit system to check for problem..."
Now try to make some peace with yourself

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