TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Israel
695
1.3k
219.8k
Deleting only for the first time (not the second time once)
Nov 11 2016 7:40 AM
Hi!
I wrote these to delete one row from database. Curiously, after to delete one and if I need to delete another I receive this message and don't want to delete another without restart my program. After to restart then Its can delete.
Error Message:
The connection was not closed. The connection's current state is open
String strConnection = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\LunaFoods\LunaFoods\App_Data\office.mdb;Persist Security Info=False";
string query = "delete from cadastramento where nprocesso='" + lblnProcessoCadastramento.Text + "';";
OleDbConnection conDatabase = new OleDbConnection(strConnection);
OleDbCommand cmdDatabase = new OleDbCommand(query, conn);
OleDbDataReader myReader;
try
{
conn.Open();
myReader = cmdDatabase.ExecuteReader();
MessageBox.Show("Dados excluidos com exito. Obrigado!");
while (myReader.Read())
{
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
Reply
Answers (
3
)
how tohave a new session for different tabs in same browser
BadImageFormatException Error