Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C# (http://www.go4expert.com/forums/c-sharp/)
-   -   Error in connection database (http://www.go4expert.com/forums/error-connection-database-t863/)

lieweffect 4Jun2006 09:54

Error in connection database
 
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 4Jun2006 22:11

Re: Error in connection database
 
It looks like you have an error in the SQL query probably.

lieweffect 5Jun2006 12:11

Re: Error in connection database
 
So,what should I do and how to fix it.
Thank Q

shabbir 5Jun2006 14:34

Re: Error in connection database
 
By correcting the errors in the query.

lieweffect 5Jun2006 16:28

Re: Error in connection database
 
May I know how to correct it please?

shabbir 5Jun2006 17:48

Re: Error in connection database
 
If you can share the query we can definitely look into it.

lieweffect 5Jun2006 19:42

Re: Error in connection database
 
Here is the whole program code

shabbir 6Jun2006 04:36

Re: Error in connection database
 
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 6Jun2006 11:07

Re: Error in connection database
 
1 Attachment(s)
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!

shabbir 7Jun2006 11:41

Re: Error in connection database
 
Whats the value of Sqlstring when its giving the exception.


All times are GMT +5.5. The time now is 18:43.