Error in connection database

lieweffect's Avatar, Join Date: Apr 2006
Contributor
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
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
It looks like you have an error in the SQL query probably.
lieweffect's Avatar, Join Date: Apr 2006
Contributor
So,what should I do and how to fix it.
Thank Q

Last edited by lieweffect; 5Jun2006 at 12:16..
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
By correcting the errors in the query.
lieweffect's Avatar, Join Date: Apr 2006
Contributor
May I know how to correct it please?
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
If you can share the query we can definitely look into it.
lieweffect's Avatar, Join Date: Apr 2006
Contributor
Here is the whole program code
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
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.
lieweffect's Avatar, Join Date: Apr 2006
Contributor
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)
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
Whats the value of Sqlstring when its giving the exception.