Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Exception in C#

Exception in C#

Scheduled Pinned Locked Moved ASP.NET
helpquestioncsharp
10 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    rapsrik
    wrote on last edited by
    #1

    Can anyone please help me with the following exception. Exception Type: System.Data.SyntaxErrorException ----------------------------------------------------------- Message: Syntax error: Missing operand after 'V' operator. ----------------------------------------------------------- Data: System.Collections.ListDictionaryInternal TargetSite: System.Data.ExpressionNode Parse() HelpLink: NULL/Undefined Source: System.Data what is a 'V' operator ?? how shld i proceed about fixing this ?? thanks

    D N A 3 Replies Last reply
    0
    • R rapsrik

      Can anyone please help me with the following exception. Exception Type: System.Data.SyntaxErrorException ----------------------------------------------------------- Message: Syntax error: Missing operand after 'V' operator. ----------------------------------------------------------- Data: System.Collections.ListDictionaryInternal TargetSite: System.Data.ExpressionNode Parse() HelpLink: NULL/Undefined Source: System.Data what is a 'V' operator ?? how shld i proceed about fixing this ?? thanks

      D Offline
      D Offline
      Dinesh Mani
      wrote on last edited by
      #2

      Can you share the details on what you are doing and the section which is raising this error?

      1 Reply Last reply
      0
      • R rapsrik

        Can anyone please help me with the following exception. Exception Type: System.Data.SyntaxErrorException ----------------------------------------------------------- Message: Syntax error: Missing operand after 'V' operator. ----------------------------------------------------------- Data: System.Collections.ListDictionaryInternal TargetSite: System.Data.ExpressionNode Parse() HelpLink: NULL/Undefined Source: System.Data what is a 'V' operator ?? how shld i proceed about fixing this ?? thanks

        N Offline
        N Offline
        nagendrathecoder
        wrote on last edited by
        #3

        Can you please provide code snippet of the lines where you are getting this error.

        R 2 Replies Last reply
        0
        • N nagendrathecoder

          Can you please provide code snippet of the lines where you are getting this error.

          R Offline
          R Offline
          rapsrik
          wrote on last edited by
          #4

          Hi.. thnks for the reply.. the issue is - i am not able to reproduce the same exception in my local.. i am in tech support for this application and its been done by a client in live environment.. i can share u the stack trace but wont be of much use i guess.. if u can giv me a rough reason of occurance this error..i'l debug and try to find the point of cause..

          1 Reply Last reply
          0
          • N nagendrathecoder

            Can you please provide code snippet of the lines where you are getting this error.

            R Offline
            R Offline
            rapsrik
            wrote on last edited by
            #5

            i'l get u the code snippet..

            public void SaveNewRecords()
            {
            try
            {
            if (!Page.IsValid)
            {
            return;
            }
            dgTravelPlan.ShowFooter = false;

                        DataTable ExistingAssociatetbl = new DataTable();
                        if (Session\[AdhocConstants.sessionRequestData\] != null)
                        {
                            ExistingAssociatetbl = (DataTable)Session\[AdhocConstants.sessionRequestData\];
            
                            ExistingAssociatetbl.Columns\[0\].AutoIncrement = true;
                            ExistingAssociatetbl.Columns\[0\].AutoIncrementSeed = 1;
                            int IdentityValue;
                            if (ExistingAssociatetbl.Rows.Count > 0)
                            {
                                IdentityValue = Convert.ToInt16(ExistingAssociatetbl.Rows\[ExistingAssociatetbl.Rows.Count - 1\]\[0\].ToString());
                                IdentityValue += 1;
                            }
                            else
                                IdentityValue = 1;
            
                            AdhocUtility objutility = new AdhocUtility();
            
                            GetTravelPlanFooter();
            
                            DataRow tblExistingRow = objutility.CreateAssociateRow(ExistingAssociatetbl, FromCity, PickupLocationType, PickupLocation, DropLocationType, DropLocation, PickupDate, PickupTime, ReturnPickupTime, NOD, Disposal, PickupTypeValue, DropTypeValue, FromCityValue, DisposalID, DestinationCityValue, InterCity);
                            tblExistingRow\["Sno"\] = IdentityValue;
                            ExistingAssociatetbl.Rows.Add(tblExistingRow);
            
            
                            if ((CheckDuplicates(ExistingAssociatetbl) == false) & (CheckDateTime(ExistingAssociatetbl) == false))
                            {
                                if (IdentityValue == 1)
                                    ExistingAssociatetbl.Rows.Find(Sno = 1).Delete();
                                ExistingAssociatetbl.AcceptChanges();
                                Session\[AdhocConstants.sessionRequestData\] = ExistingAssociatetbl;
                                dgTravelPlan.DataSource = Session\[AdhocConstants.sessionRequestData\];
                                dgTravelPlan.DataBind();
                                if (strStatus == AdhocConstants.TypeModify)
                                    dgTravelPlan.Rows\[0\].Visible = true;
                                else
                                    dgTravelPlan.Rows\[0\].Visible = false;
            
                                btnSubmit.Visible = true;
            
            N J 2 Replies Last reply
            0
            • R rapsrik

              i'l get u the code snippet..

              public void SaveNewRecords()
              {
              try
              {
              if (!Page.IsValid)
              {
              return;
              }
              dgTravelPlan.ShowFooter = false;

                          DataTable ExistingAssociatetbl = new DataTable();
                          if (Session\[AdhocConstants.sessionRequestData\] != null)
                          {
                              ExistingAssociatetbl = (DataTable)Session\[AdhocConstants.sessionRequestData\];
              
                              ExistingAssociatetbl.Columns\[0\].AutoIncrement = true;
                              ExistingAssociatetbl.Columns\[0\].AutoIncrementSeed = 1;
                              int IdentityValue;
                              if (ExistingAssociatetbl.Rows.Count > 0)
                              {
                                  IdentityValue = Convert.ToInt16(ExistingAssociatetbl.Rows\[ExistingAssociatetbl.Rows.Count - 1\]\[0\].ToString());
                                  IdentityValue += 1;
                              }
                              else
                                  IdentityValue = 1;
              
                              AdhocUtility objutility = new AdhocUtility();
              
                              GetTravelPlanFooter();
              
                              DataRow tblExistingRow = objutility.CreateAssociateRow(ExistingAssociatetbl, FromCity, PickupLocationType, PickupLocation, DropLocationType, DropLocation, PickupDate, PickupTime, ReturnPickupTime, NOD, Disposal, PickupTypeValue, DropTypeValue, FromCityValue, DisposalID, DestinationCityValue, InterCity);
                              tblExistingRow\["Sno"\] = IdentityValue;
                              ExistingAssociatetbl.Rows.Add(tblExistingRow);
              
              
                              if ((CheckDuplicates(ExistingAssociatetbl) == false) & (CheckDateTime(ExistingAssociatetbl) == false))
                              {
                                  if (IdentityValue == 1)
                                      ExistingAssociatetbl.Rows.Find(Sno = 1).Delete();
                                  ExistingAssociatetbl.AcceptChanges();
                                  Session\[AdhocConstants.sessionRequestData\] = ExistingAssociatetbl;
                                  dgTravelPlan.DataSource = Session\[AdhocConstants.sessionRequestData\];
                                  dgTravelPlan.DataBind();
                                  if (strStatus == AdhocConstants.TypeModify)
                                      dgTravelPlan.Rows\[0\].Visible = true;
                                  else
                                      dgTravelPlan.Rows\[0\].Visible = false;
              
                                  btnSubmit.Visible = true;
              
              N Offline
              N Offline
              nagendrathecoder
              wrote on last edited by
              #6

              rapsrik wrote:

              if ((CheckDuplicates(ExistingAssociatetbl) == false) & (CheckDateTime(ExistingAssociatetbl)

              For me, problem seems to be here, "&" is Unary AND operator and you are using it as Logical AND. Try to use "&&" operator, its Logical AND operator used in if conditions. I am not too sure whether it'll solve your problem, but i think error is for that only. Try it. :)

              R 1 Reply Last reply
              0
              • N nagendrathecoder

                rapsrik wrote:

                if ((CheckDuplicates(ExistingAssociatetbl) == false) & (CheckDateTime(ExistingAssociatetbl)

                For me, problem seems to be here, "&" is Unary AND operator and you are using it as Logical AND. Try to use "&&" operator, its Logical AND operator used in if conditions. I am not too sure whether it'll solve your problem, but i think error is for that only. Try it. :)

                R Offline
                R Offline
                rapsrik
                wrote on last edited by
                #7

                hey thnks dude.. :) lemme try that

                1 Reply Last reply
                0
                • R rapsrik

                  Can anyone please help me with the following exception. Exception Type: System.Data.SyntaxErrorException ----------------------------------------------------------- Message: Syntax error: Missing operand after 'V' operator. ----------------------------------------------------------- Data: System.Collections.ListDictionaryInternal TargetSite: System.Data.ExpressionNode Parse() HelpLink: NULL/Undefined Source: System.Data what is a 'V' operator ?? how shld i proceed about fixing this ?? thanks

                  A Offline
                  A Offline
                  Arindam Tewary
                  wrote on last edited by
                  #8

                  Hi, (1) If you have any access to "event viewer" of the hosting server, did you get any exception details there or any more information? (2) I have seen you have provided a big code block, however did you identify which line it is causing the exception? if you can do that it would be great so that we can help you more.

                  Thanks, Arindam D Tewary

                  R 1 Reply Last reply
                  0
                  • A Arindam Tewary

                    Hi, (1) If you have any access to "event viewer" of the hosting server, did you get any exception details there or any more information? (2) I have seen you have provided a big code block, however did you identify which line it is causing the exception? if you can do that it would be great so that we can help you more.

                    Thanks, Arindam D Tewary

                    R Offline
                    R Offline
                    rapsrik
                    wrote on last edited by
                    #9

                    Hey hi.. this block actually if (ExistingAssociatetbl.Rows.Count > 0) { IdentityValue = Convert.ToInt16(ExistingAssociatetbl.Rows[ExistingAssociatetbl.Rows.Count - 1][0].ToString()); IdentityValue += 1; } and also.. the stack exception shows error in this method too.. and the line is marked with two ** private bool CheckDuplicates(System.Data.DataTable dtCheckDuplicates) { DataTable dtDuplicateRecords = dtCheckDuplicates.Clone(); bool blnCheckDuplicate; for (int iRow = 0; iRow <= dtCheckDuplicates.Rows.Count - 1; iRow++) { blnCheckDuplicate = false; ** string strCheckRow = string.Empty; object[] arr = dtCheckDuplicates.Rows[iRow].ItemArray; for (int iColumn = 0; iColumn <= arr.Length - 1; iColumn++) { if (dtCheckDuplicates.Columns[iColumn].ColumnName.Trim().ToUpper() != "SNO") { if (iColumn != arr.Length - 1) strCheckRow += dtCheckDuplicates.Columns[iColumn].ColumnName + " = '" + arr[iColumn].ToString() + "' and "; else strCheckRow += dtCheckDuplicates.Columns[iColumn].ColumnName + " = '" + arr[iColumn].ToString() + "'"; } } if (dtDuplicateRecords.Select(strCheckRow).Length > 0) { blnCheckDuplicate = true; } if (!blnCheckDuplicate) { DataRow[] drs = dtCheckDuplicates.Select(strCheckRow); if (drs.Length > 1) { lblError.Text = ""; lblError.Text = AdhocConstants.DuplicateTravelPlan; return true; } } } return false; } thnks for the help..

                    1 Reply Last reply
                    0
                    • R rapsrik

                      i'l get u the code snippet..

                      public void SaveNewRecords()
                      {
                      try
                      {
                      if (!Page.IsValid)
                      {
                      return;
                      }
                      dgTravelPlan.ShowFooter = false;

                                  DataTable ExistingAssociatetbl = new DataTable();
                                  if (Session\[AdhocConstants.sessionRequestData\] != null)
                                  {
                                      ExistingAssociatetbl = (DataTable)Session\[AdhocConstants.sessionRequestData\];
                      
                                      ExistingAssociatetbl.Columns\[0\].AutoIncrement = true;
                                      ExistingAssociatetbl.Columns\[0\].AutoIncrementSeed = 1;
                                      int IdentityValue;
                                      if (ExistingAssociatetbl.Rows.Count > 0)
                                      {
                                          IdentityValue = Convert.ToInt16(ExistingAssociatetbl.Rows\[ExistingAssociatetbl.Rows.Count - 1\]\[0\].ToString());
                                          IdentityValue += 1;
                                      }
                                      else
                                          IdentityValue = 1;
                      
                                      AdhocUtility objutility = new AdhocUtility();
                      
                                      GetTravelPlanFooter();
                      
                                      DataRow tblExistingRow = objutility.CreateAssociateRow(ExistingAssociatetbl, FromCity, PickupLocationType, PickupLocation, DropLocationType, DropLocation, PickupDate, PickupTime, ReturnPickupTime, NOD, Disposal, PickupTypeValue, DropTypeValue, FromCityValue, DisposalID, DestinationCityValue, InterCity);
                                      tblExistingRow\["Sno"\] = IdentityValue;
                                      ExistingAssociatetbl.Rows.Add(tblExistingRow);
                      
                      
                                      if ((CheckDuplicates(ExistingAssociatetbl) == false) & (CheckDateTime(ExistingAssociatetbl) == false))
                                      {
                                          if (IdentityValue == 1)
                                              ExistingAssociatetbl.Rows.Find(Sno = 1).Delete();
                                          ExistingAssociatetbl.AcceptChanges();
                                          Session\[AdhocConstants.sessionRequestData\] = ExistingAssociatetbl;
                                          dgTravelPlan.DataSource = Session\[AdhocConstants.sessionRequestData\];
                                          dgTravelPlan.DataBind();
                                          if (strStatus == AdhocConstants.TypeModify)
                                              dgTravelPlan.Rows\[0\].Visible = true;
                                          else
                                              dgTravelPlan.Rows\[0\].Visible = false;
                      
                                          btnSubmit.Visible = true;
                      
                      J Offline
                      J Offline
                      J a a n s
                      wrote on last edited by
                      #10

                      Please check the following line.

                      if (IdentityValue == 1)
                      ExistingAssociatetbl.Rows.Find(Sno = 1).Delete();

                      Some assignment is happening in the find method when it expects an object. Please check it.

                      "Never put off until run time what you can do at compile time." - David Gries, in "Compiler Construction for Digital Computers", circa 1969.

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups