473,397 Members | 2,099 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

A first chance exception of type 'System.Data.Odbc.OdbcException' occurred in System.

Hi I have been trying to get the data display on the datagrid after selecting a customer.

With the same connection it populates the selection right. But just do not seem to extract the following SQL.

The litABC is to check the flow of control.

There is no syntax error but in the debug menu,
I got A first chance exception of type 'System.Data.Odbc.OdbcException' occurred in System.

Where did I do wrong?


Expand|Select|Wrap|Line Numbers
  1. public void DoReport()
  2.     {
  3.         try
  4.         {
  5.             string sSQL = "";
  6.             string sTitle = "";
  7.             string sGrouping = "";
  8.  
  9.             // if the start date and end date are not set show the alert. 
  10.             if (!(dcalStart.IsSet && dcalEnd.IsSet))
  11.             {
  12.                 CommonFunctions.ShowAlert(this, "You must select Start and End dates for the report. ");
  13.                 return;
  14.             }
  15.  
  16.             string sBillTo = lstCustomer.SelectedValue;
  17.             string sStart = dcalStart.Text;
  18.             string sEnd = dcalEnd.Text;
  19.  
  20.  
  21.             litABC.Text = "0";
  22.  
  23.             if (!string.IsNullOrEmpty(sBillTo))
  24.             {
  25.                 sSQL = "SELECT deb_master FROM deb_import";
  26.  
  27.                 sTitle = "Customer Group '" + sBillTo.Trim() + "'";
  28.                 sGrouping = "Branch";
  29.  
  30.                 litABC.Text = "1";
  31.             }
  32.             else
  33.             {
  34.                 sTitle = "Second Line '" + sBillTo.Trim() + "'";
  35.                 sGrouping = "Where is the data????";
  36.  
  37.                 litABC.Text = "2";
  38.             }
  39.  
  40.             DataTable res = DataFunctions.SQLToDataTable(sSQL);
  41.  
  42.             Results.Columns[0].HeaderText = sGrouping;
  43.             Results.DataSource = Results;
  44.             Results.DataBind();
  45.  
  46.             litTitle.Text = sSQL;
  47.             litDateRange.Text = sStart + " - " + sEnd;
  48.  
  49.             Results.Visible = true;
  50.             tblOutput.Visible = true;
  51.         }
  52.         catch (Exception ex)
  53.         {
  54.             Literal l = new Literal();
  55.             l.Text = "<p style=\"font-weight: bold; color: red;\">" + ex.Message + "</p>";
  56.             phError.Controls.Add(l);
  57.         }
  58.  
  59.     }
  60.  
  61.  
Jul 6 '10 #1
1 4199
this was solved by adding additional row in the result set.
Jul 8 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: karunakar | last post by:
Hi All Here iam getting this Error "Specified cast is not valid." My Project has Onc solution diffrent class libarary In that solution DALfactory solution iam getting this error I was calling...
2
by: Juanjo | last post by:
Hi all I get the following error: 'A first chance exception of type 'System.InvalidOperationException' occurred in system.dll Additional information: The requested Performance Counter is not...
0
by: NicK chlam via DotNetMonster.com | last post by:
this is the error i get System.Data.OleDb.OleDbException: Syntax error in INSERT INTO statement. at System.Data.Common.DbDataAdapter.Update(DataRow dataRows, DataTableMapping tableMapping) at...
0
by: camp | last post by:
Hi, The question bellow was posted on .NET 247 with no resolve (issue seems to be extremly difficult) I am having exactly the same problem, so I copied the question and pasted it bellow for...
3
by: Pieter | last post by:
Hi, I have a Windows Forms application (VB.NET 2.0) which uses a Class Library in C#. The application runs fine, but when I run it in debug mode, I get several "A first chance exception of type...
1
by: Tommy | last post by:
I get this message in the output window of my app I just converted from VS 2003 to 2005. It's a VB.Net app. A first chance exception of type 'System.InvalidCastException' occurred in...
3
by: GS | last post by:
why am i getting A first chance exception of type 'System.NullReferenceException' occurred in myapp.exe below? and what can i do get rid of it? Private Function getPrefxType() As String If...
0
by: sanishvarier | last post by:
Hi, I am getting the fillowing error A first chance exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.dll when trying to use the OpenFile property of OpenFile dialog box. ...
7
by: Pixel.to.life | last post by:
Gurus, Another question on one of the coveted Microsoft products: JIT debugger with VS2005. I have a managed app that builds great on one machine (Vista Home basic, VS2005, JIT enabled for...
0
by: Pixel.to.life | last post by:
Gurus, Another question on one of the coveted Microsoft products: JIT debugger with VS2005. I have a managed app that builds great on one machine (Vista Home basic, VS2005, JIT enabled for...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.