473,804 Members | 3,716 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

A first chance exception of type 'System.Data.Od bc.OdbcExceptio n' occurred in System.

44 New Member
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.Od bc.OdbcExceptio n' 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 4229
yimma216
44 New Member
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
8234
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 this function in DALFactory class library(this library generate the DAL.dll) Another class library has this function public SecurityInfo Login(string username, string password) {
2
18900
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 a custom counter, it has to be initialized as ReadOnly.'
0
5680
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 System.Data.Common.DbDataAdapter.Update(DataSet dataSet, String srcTable) at System.Data.Common.DbDataAdapter.Update(DataSet dataSet) at TryThis.Form1.save() in C:\Documents and Settings\Nick\My Documents\...
0
1362
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 Microsoft: QUESTION ------------ I'm running VS.NET 2003. I have an ASP.NET application that has been working just fine in both debug &
3
31146
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 'System.ArgumentOutOfRangeException' occurred in mscorlib.dll" -exceptions that are shown in the Immediate window of Visual Studio 2005. I want to get rid of these exceptions, but I can(t find where they occur.
1
1684
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 Microsoft.VisualBasic.dll How can I find these exceptions so I can take care of them? They do not show up in the errors or warnings window. Thanks
3
22377
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 bSkipGetListBOxComboBoxValue Then Return "" Try
0
4525
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. any suggestions on this issue ...
7
1831
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 managed/unmanaged code). I can also debug it on this machine with breakpoints and all. Now I move the same code on another machine (XP Pro, VS2005, JIT
0
1422
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 managed/unmanaged code). I can also debug it on this machine with breakpoints and all.
0
9707
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9585
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10338
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10323
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10082
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9161
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7622
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5658
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2997
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.