Connecting Tech Pros Worldwide Help | Site Map

Databse C# problem

Newbie
 
Join Date: Feb 2009
Location: Milton Keynes, UK
Posts: 5
#1: Feb 9 '09
Hi, i have a problem while trying to build my program, i have this code in the Form 1 Load :
Expand|Select|Wrap|Line Numbers
  1. private void Form1_Load(object sender, System.EventArgs e)
  2.         {
  3.             objOleDbConnection.Open();
  4.  
  5.             OleDbDataReader objReader = objSelectAccount.ExecuteReader();    <<< Breaks here
  6.  
  7.             while (objReader.Read()) 
  8.             {
  9.                 cmbAccountNumbers.Items.Add(objReader["Account Number"]);
  10.             }
  11.             objOleDbConnection.Close();
  12.         }
  13.  
and shows me this error :"An unhandled exception of type 'System.Data.OleDb.OleDbException' occurred in system.data.dll"

the interesting thing is that it throws me the same error in college computers in one campus, and was building fine on other college campus and at home, but now is breaking at home as well.

Any suggestions?

Thank you
Newbie
 
Join Date: Feb 2009
Location: Bangalore
Posts: 12
#2: Feb 10 '09

re: Databse C# problem


there might be some problem with data base installation. try using another data base using a small program, just to make sure that its not problem with data base.
PRR PRR is offline
Moderator
 
Join Date: Dec 2007
Location: India
Posts: 700
#3: Feb 10 '09

re: Databse C# problem


1. Are you sure your connection string and username password are valid?
2. Make sure your database serve is on?

Do go through Database
Your code doesn't seem to be complete... can you provide more sample code?
Newbie
 
Join Date: Feb 2009
Location: Milton Keynes, UK
Posts: 5
#4: Feb 10 '09

re: Databse C# problem


"1. Are you sure your connection string and username password are valid?
2. Make sure your database serve is on?

Do go through Database
Your code doesn't seem to be complete... can you provide more sample code? "


the database does not have have a username or password, so i don't think its that, and the database server is on :\
I have also tried to build my the backup of the application which i created over a month ago, and the same problem is happening, so i presume its ether my security settings or the computer itself.. hmm..
Newbie
 
Join Date: Feb 2009
Location: Milton Keynes, UK
Posts: 5
#5: Feb 10 '09

re: Databse C# problem


fixed it now, so don't worry :).. it was an amateur mistake, even too embarrassing to mention
Newbie
 
Join Date: Feb 2009
Location: Bangalore
Posts: 12
#6: Feb 11 '09

re: Databse C# problem


ha ha ha, its ok Pega, we all do mistake, any way what was the mistake :)
PRR PRR is offline
Moderator
 
Join Date: Dec 2007
Location: India
Posts: 700
#7: Feb 11 '09

re: Databse C# problem


its alright ... we all do mistakes.... Please do continue post your queries on Bytes
Newbie
 
Join Date: Feb 2009
Location: Milton Keynes, UK
Posts: 5
#8: Feb 11 '09

re: Databse C# problem


Basically, I have made my project on my USB drive, so i can take work to college and work there too, and when I created the link between the program and database, the directory was through F: drive, and when it was crashing the name of the USB was U: or G:, but it was still looking for F: drive :\
Rookie mistake
Reply

Tags
.net, c sharp, database, problem, system.data.dll