473,503 Members | 11,018 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Operation not valid

Ciao,

Hi,
a datagrid on my form displays a table T, fine.
On the form I have a button. I want to execute a query on T, just
clicking that button.
DB is Oracle. Button_Click code is:

....
Dim QSele As String = "select field1 from T"
Dim mycmd As New OracleCommand(QSele, con)
mycmd.CommandType = CommandType.Text
Try
mycmd.ExecuteNonQuery() '
Catch ex As Exception
MessageBox.Show(ex.Message)
Finally
mycmd = Nothing
End Try

At line mycmd.ExecuteNonQuery I get an error:
"Operation is not valid due to the current state of the object"
Qualcuno puo' aiutarmi? Ciao,
in una datagrid su un form visualizzo correttamente il contenuto di una

tabella T.
Accanto c'e' un bottone, cliccando sul quale voglio eseguire una query
sulla stessa tabella.
Il database e' Oracle, all'inizio della mia classe ho la riga:
Imports Oracle.DataAccess.Client
Il codice del click del bottone e':
....
Dim QSele As String = "select field1 from T"
Dim mycmd As New OracleCommand(QSele, con)
mycmd.CommandType = CommandType.Text
Try
mycmd.ExecuteNonQuery() '
Catch ex As Exception
MessageBox.Show(ex.Message)
Finally
mycmd = Nothing
End Try
Quando il programma esegue mycmd.ExecuteNonQuery ho l'errore:
"Operation is not valid due to the current state of the object"

Anybody can help? Thanks

N! Xau

Nov 21 '05 #1
0 1271

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2289
by: Mikael Syska | last post by:
Hey, Cross-thread operation not valid: Control 'ThreadStartedAt' accessed from a thread other than the thread it was created on I get this Exception when I try to update some labels/textbox's...
1
6959
by: Zeya | last post by:
I have this code, which uses WMI to operate on Windows service from C# code. When Service.InvokeMethod is called, the method throws an exception: System.Management Operation is not valid due...
0
1523
by: Abubakar | last post by:
Hi, try { int x = ns.Read(readbuffer, 0, readbuffer.Length); } catch (System.IO.IOException ioexception) { UINotifications.ServerMessageDisplay(ioexception.ToString( )); }
1
9473
by: Mesan | last post by:
I'm getting a "Cross-thread operation not valid" Exception and I can't figure out why. I've got a BackgroundWorker that creates a UserControl with a whole lot of other user controls inside of...
8
4829
by: Pieter | last post by:
Hi, I'm having some weird problem using the BackGroundWorker in an Outlook (2003) Add-In, with VB.NET 2005: I'm using the BackGroundWorker to get the info of some mailitems, and after each item...
11
8653
by: HairlipDog58 | last post by:
Hello, There are several 'cross-thread operation not valid' exception postings in the MSDN discussion groups, but none address my exact situation. I have authored a .NET component in Visual C#...
3
5390
by: Pieter Coucke | last post by:
Hi, In my VB.NET 2005 application I'm generating and sending emails using the outlook-object model (2003). When a mail is Send (MailObject_Send), I raise an event in a global class, that is...
5
3583
by: nospam | last post by:
Hi all. I have encountered a "Cross-thread operation not valid" error in a test program I created and although I have came up with a solution I don't like the performance of the program. I...
1
2525
by: subramanian100in | last post by:
Suppose I have vector<intvi; deque<intdi; list<intli; Suppose all of these containers have some elements. Suppose 'v_iter' is an iterator pointing to some element in 'vi'. Suppose 'v_beg'...
0
7207
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7294
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7361
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7015
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7470
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5602
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5026
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4693
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
403
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.