473,696 Members | 1,742 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Very Simple Problem

Hello All,

Hope somebody wouldn`t mind helping me, i have a problem and as a newbie I
don`t know where im going wrong:

I keep getting the following error "An unhandled exception of type
'System.Data.Ol eDb.OleDbExcept ion' occurred in system.data.dll " on the line
that says: "daPatientsIDs. Fill(dtPatients IDs)"

When trying to run this Code:

'CODE START
Option Strict On
Imports System.Data.Ole Db

Public Class Form1
Inherits System.Windows. Forms.Form

Dim dbConnection As OleDbConnection
Dim dbCommand As OleDbCommand
Dim dbDataAdapter As OleDbDataAdapte r
Dim ConnectString As String = "Provider = Microsoft.Jet.O LEDB.4.0;" &
"Data Source = Hospital.MDB"
Dim dtPatientsIDs As New DataTable()
Dim daPatientsIDs As New OleDbDataAdapte r("Select [Patients ID] from
Patients", ConnectString)

Private Sub Form1_Load(ByVa l sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
daPatientsIDs.F ill(dtPatientsI Ds)
lstPatientIDs.D ataSource = dtPatientsIDs
lstPatientIDs.D isplayMember = "Patient ID"

OleDbDataAdapte r.Fill(dsPatien tsAndWards)

txtWardName.Dat aBindings.Add(" Text", dsPatientsAndWa rds, "Patients.W ard
Name")
txtWardType.Dat aBindings.Add(" Text", dsPatientsAndWa rds, "Patients.W ard
Type")

End Sub
End Class
'CODE FINISH

Anybody shed any light on this?

Regards
Merlin
Nov 20 '05 #1
5 1637

"Merlin" <te**@nospam.co m> wrote in message
news:Rp******** ************@ka roo.co.uk...
Hello All,

Hope somebody wouldn`t mind helping me, i have a problem and as a newbie I
don`t know where im going wrong:

I keep getting the following error "An unhandled exception of type
'System.Data.Ol eDb.OleDbExcept ion' occurred in system.data.dll " on the line that says: "daPatientsIDs. Fill(dtPatients IDs)"

You need to put your fill statement in a try block, that way you will get a
descriptive error. Something like this:

....
Try
OleDbDataAdapte r.Fill(dsPatien tsAndWards)
Catch Ex as Exception
Console.WriteLi ne("Error: " & ex.Message)
Msgbox("Error: " & Ex.Message)
End Try
....

Then run it again, and give us the descriptive error message.

~
Jeremy

Nov 20 '05 #2
"Merlin" <te**@nospam.co m> schrieb

Hope somebody wouldn`t mind helping me, i have a problem and as a
newbie I don`t know where im going wrong:

I keep getting the following error "An unhandled exception of type
'System.Data.Ol eDb.OleDbExcept ion' occurred in system.data.dll " on
the line that says: "daPatientsIDs. Fill(dtPatients IDs)"


Already tried putting it in a try-catch block and examining the thrown
exception? Exception should contain details.

If it turns out to be an ADO.NET related question: Right group is
microsoft.publi c.dotnet.framew ork.adonet
--
Armin

http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #3
Jeremy i`ve put the code in Try Expressions like you said and it throws up:

"Additional information: This would cause two bindings in the collection to
bind to the same property." on:

txtWardName.Dat aBindings.Add(" Text", dsPatientsAndWa rds, "Patients.W ard
Name")
txtWardType.Dat aBindings.Add(" Text", dsPatientsAndWa rds, "Patients.W ard
Type")

In my book that im working from it say "In the Forms Load event, write the
following code to fill the dataset from the the data adapter and then to
bind the two textboxes displaying details about the wards to the ward name
and ward type fields in the dataset"

Thanks for you help so far

Ta
Merlin

"Merlin" <te**@nospam.co m> wrote in message
news:Rp******** ************@ka roo.co.uk...
Hello All,

Hope somebody wouldn`t mind helping me, i have a problem and as a newbie I
don`t know where im going wrong:

I keep getting the following error "An unhandled exception of type
'System.Data.Ol eDb.OleDbExcept ion' occurred in system.data.dll " on the line that says: "daPatientsIDs. Fill(dtPatients IDs)"

When trying to run this Code:

'CODE START
Option Strict On
Imports System.Data.Ole Db

Public Class Form1
Inherits System.Windows. Forms.Form

Dim dbConnection As OleDbConnection
Dim dbCommand As OleDbCommand
Dim dbDataAdapter As OleDbDataAdapte r
Dim ConnectString As String = "Provider = Microsoft.Jet.O LEDB.4.0;" &
"Data Source = Hospital.MDB"
Dim dtPatientsIDs As New DataTable()
Dim daPatientsIDs As New OleDbDataAdapte r("Select [Patients ID] from
Patients", ConnectString)

Private Sub Form1_Load(ByVa l sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
daPatientsIDs.F ill(dtPatientsI Ds)
lstPatientIDs.D ataSource = dtPatientsIDs
lstPatientIDs.D isplayMember = "Patient ID"

OleDbDataAdapte r.Fill(dsPatien tsAndWards)

txtWardName.Dat aBindings.Add(" Text", dsPatientsAndWa rds, "Patients.W ard Name")
txtWardType.Dat aBindings.Add(" Text", dsPatientsAndWa rds, "Patients.W ard Type")

End Sub
End Class
'CODE FINISH

Anybody shed any light on this?

Regards
Merlin

Nov 20 '05 #4
"Merlin" <te**@nospam.co m> wrote in message
news:mp******** ************@ka roo.co.uk...
Jeremy i`ve put the code in Try Expressions like you said and it throws up:
"Additional information: This would cause two bindings in the collection to bind to the same property." on:

txtWardName.Dat aBindings.Add(" Text", dsPatientsAndWa rds, "Patients.W ard
Name")
txtWardType.Dat aBindings.Add(" Text", dsPatientsAndWa rds, "Patients.W ard
Type")

In my book that im working from it say "In the Forms Load event, write the
following code to fill the dataset from the the data adapter and then to
bind the two textboxes displaying details about the wards to the ward name
and ward type fields in the dataset"

My *guess* is that your code is executing more than once, and doubling the
bindings, however this question really belongs in the ADO.NET Group:

microsoft.publi c.dotnet.framew ork.adonet
~
Jeremy

Nov 20 '05 #5
One other thing you might try is stepping through each line of code to see
exactly when it crashes. You can do this by selecting "Debug > Step Into"
on the main menu at Design Time (while the app is NOT running) or F8 if you
use VB Classic key bindings.

~
Jeremy

Nov 20 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

16
21314
by: mamo74 | last post by:
Hello. I am administering a SQL Server (Enterprise Edition on Windows 2003) from some month and can't understand what is going on in the latest week (when the db grow a lot). The DB is around 250G, and has one table with 1 billion rows. It is performing in a decent way, but can't understand why a particolar table has strong performance problem.
6
8524
by: leonecla | last post by:
Hi everybody, I'm facing a very very strange problem with a very very simple C program... My goal should be to write to a binary file some numbers (integers), each one represented as a sequence of 32 bit. I made this stupid trial code: --------------------------------------------- FILE *fout;
2
1692
by: Dave | last post by:
I build a very simple program that I put at the end of this post. This program is just supposed to put a button on the screen and exit the program when I press the escape button. But pressing the escape button doesn't do anything if I put the code for the button into the program! infact, pressing escape only works if you take away the little piece of code: "this.Controls.Add(this.button1);"!! I was totally confused at why this happened...
0
2617
by: roiavidan | last post by:
Hi, I'm having a bit of a problem with a small application I wrote in C#, which uses an Access database (mdb file) for storing financial data. After looking for a similiar topic and failing to find one, I'm posting the question in hope some one of you guys out there will have the answer for me...! I'll start with what I have, then I'll continue to the problem itself.
9
10499
by: Vito DeCarlo | last post by:
I've been having this problem for a few weeks. PLEASE read this post before responding with some simple reason that has nothing to do with my problem. If you need more information, please request it as I'll be checking this post very often. PROBLEM: Occaisionally, our web server begins running ASP.NET pages extremely slowly. Other websites on the server run fine, including ASP pages. It almost seems as if the .NET caching system...
0
1744
by: tom | last post by:
Hallo, I need help on MIDI file, and precisely about retrieving few note values (mainly the "Velocity" value, corrisponding to the intensity of a played note) while the MIDI is playing.
3
7566
by: cold80 | last post by:
I was just doing a performance test in order to see the benefit of using AJAX instead of doing a postback on the server. So I have a simple page that performs a request to the server and write a counter on the page when it receives the response from the server. I'm not changing the page actually, so the browser don't have to modify the internal DOM and to render the changes. I tried this simple page with IE 7.0, Firefox 2.0 and Opera 9.10....
1
2242
by: Ramsesz | last post by:
Hi all, I am new here (forgive me if I do not follow forum-rules which i am not yet familiar with). I have a problem that bugs me quite some time now. I did not find any solutions on the net, so I hope you guys can help me out! I have a very simple html form (for test purposes): <form method='post' action='processForm.asp'> <input type='text' name='email' /> <input type='submit' value='submit' /> </form>
112
4695
by: Prisoner at War | last post by:
Friends, your opinions and advice, please: I have a very simple JavaScript image-swap which works on my end but when uploaded to my host at http://buildit.sitesell.com/sunnyside.html does not work. To rule out all possible factors, I made up a dummy page for an index.html to upload, along the lines of <html><head><title></title></ head><body></body></html>.; the image-swap itself is your basic <img src="blah.png"...
5
1757
by: Ibys | last post by:
Hi, i am just starting to learn javascript, so i am probably doing something very simple wrong. i have read a lot of articles on maths in java, but cant find anything simple enough for my problem. I am looking for how to get an IF statement to give me the correct output. I am trying to get it to give me a result for a weeks pay, taking that the code worked before i tried to add the IF statement, to make it that if HoursWorked >= 20, the rate of...
0
8658
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
8594
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
9005
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...
0
8847
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...
1
6512
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
5853
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4352
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3027
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2310
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.