Click here to Skip to main content
15,909,332 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i give this error in this line :
Mysp_tblFeeds_Update.ExecuteNonQuery();
Posted

just open the connection before that statment .

Con.open();
 
Share this answer
 
The error message does explain the problem pretty clearly: you haven't created a connection, or your connection string is wrong, or you haven't opened the connect before you try to use it.

But...from just one line of code we can't even start to tell which.
So look at you code, find where the Connection instance is created, and see what happens to it from there. We can't do that for you: we can't see your screen, access your HDD, or read your mind...
 
Share this answer
 
Comments
‫محم د‬‎ 25-Jun-14 9:24am    
my connection is true ! and i open that ! but ....
see :
cm.Connection.Open();
Mysp_tblFeeds_Update.ExecuteNonQuery();
cn.Close();
goathik 25-Jun-14 9:25am    
did you mistyped "cm" and "cn" ? or perhaps that can possibly be the problem?
goathik 25-Jun-14 9:26am    
anyway, please, insert your full block of code for better analysis
C#
if (conn.State == ConnectionState.Open)
                    conn.Close();
                conn.Open();

Check your connection object
 
Share this answer
 
it seems you are opening some other connection. do as below
C#
Mysp_tblFeeds_Update.Connection.Open();
Mysp_tblFeeds_Update.ExecuteNonQuery();

that will make sure you are opening connection of the command
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900