Error in connection database

Contributor
4Jun2006,09:54   #1
lieweffect's Avatar
Once I run the program it give me this error:
An unhandled exception of type 'System.Data.OleDb.OleDbException' occurred in system.data.dll

Here is the code:
OleDbConnection Conn=new OleDbConnection(ConnString);
Conn.Open();
OleDbDataReader dr;
OleDbCommand dbcom=new OleDbCommand();
DataSet ds=new DataSet();
OleDbDataAdapter da=new OleDbDataAdapter();
da.SelectCommand=new OleDbCommand(Sqlstring,Conn);
da.Fill(ds);
dbcom.Connection=(Conn);
dbcom.CommandText=Sqlstring;
dr=dbcom.ExecuteReader();

it say the dbcom is undefined value.
How to fix it
Help!Thank Q
Go4Expert Founder
4Jun2006,22:11   #2
shabbir's Avatar
It looks like you have an error in the SQL query probably.
Contributor
5Jun2006,12:11   #3
lieweffect's Avatar
So,what should I do and how to fix it.
Thank Q

Last edited by lieweffect; 5Jun2006 at 12:16..
Go4Expert Founder
5Jun2006,14:34   #4
shabbir's Avatar
By correcting the errors in the query.
Contributor
5Jun2006,16:28   #5
lieweffect's Avatar
May I know how to correct it please?
Go4Expert Founder
5Jun2006,17:48   #6
shabbir's Avatar
If you can share the query we can definitely look into it.
Contributor
5Jun2006,19:42   #7
lieweffect's Avatar
Here is the whole program code
Go4Expert Founder
6Jun2006,04:36   #8
shabbir's Avatar
Please dont attach the complete projects as its very difficult to find where the error is and where the query is. I have removed the attached project.

Please read Before you make a query.
Contributor
6Jun2006,11:07   #9
lieweffect's Avatar
Sorry, because I don't know how to find the query as you know I'm the beginner of programming.If I did something please correct me!
Attached Files
File Type: doc db.doc (1.5 KB, 7 views)
Go4Expert Founder
7Jun2006,11:41   #10
shabbir's Avatar
Whats the value of Sqlstring when its giving the exception.