473,785 Members | 2,482 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Deleting row from datagrid failing

I am having a "not all variables bound" issue when trying to delete a row
from a datagrid.

I have a datagrid populated with data from a oracle table as follows:

da = New OracleDataAdapt er("SELECT a.inst, a.group, a.privs,
b.field FROM table a, table b WHERE.......

da.Fill(ds, "TW_GROUP_PRIVS ")
da.datamember = "TW_GROUP_PRIVS ")
I have the insert and update statements working correctly, they are as
follows:

Dim cmd As New OracleCommand(" UPDATE TW_GROUP_PRIVS SET group =
:original_group , inst = :Original_inst, privs = :privs WHERE inst =
:original_inst AND group = :original_group ")

cmd.Parameters. Add(New OracleParameter (":original_gro up",
OracleType.VarC har, 30, "GROUP"))
cmd.Parameters. Add(New OracleParameter (":original_ins t",
OracleType.VarC har, 10, "Inst"))
cmd.Parameters. Add(New OracleParameter (":PRIVS",
OracleType.VarC har, 37, "PRIVS"))
cmd.Parameters. Add(New OracleParameter (":ORIGINAL_DES CRIPTION",
OracleType.VarC har, 100, "DESCRIPTIO N"))
Dim cmd2 As New OracleCommand(" INSERT INTO TW_GROUP_PRIVS
(group, inst, privs, description)
VALUES (:group_name, :institution_id , :privs, :field)")

cmd2.Parameters .Add(New OracleParameter (":group",
OracleType.VarC har, 30, "GROUP"))
cmd2.Parameters .Add(New OracleParameter (":inst",
OracleType.VarC har, 10, "Inst"))
cmd2.Parameters .Add(New OracleParameter (":PRIVS",
OracleType.VarC har, 37, "PRIVS"))
cmd2.Parameters .Add(New OracleParameter (":field",
OracleType.VarC har, 100, "field"))

cmd.Connection = Conn
cmd2.Connection = Conn
da.UpdateComman d = cmd
da.InsertComman d = cmd2
Conn.Open()
da.Update(ds, "TW_GROUP_PRIVS ")

I am running into issues with the delete portion of the code.

First, I remove the row from the datagrid:
if (Me.BindingCont ext(ds, "TW_GROUP_PRIVS ").Count > 0) Then
Me.BindingConte xt(ds,
"TW_GROUP_PRIVS ").RemoveAt(Me. BindingContext( ds, "TW_GROUP_PRIVS ").Position )
end if

Now I want to delete the row from the source table:

'Dim cmd3 As New OracleCommand(" DELETE FROM TW_GROUP_PRIVS WHERE
inst = :original_inst" _
&" AND group = :original_group AND privs = :original_privs and
description = :original_field ")

cmd3.Parameters .Add(New OracleParameter (":Original_gro up",
OracleType.VarC har, 30, "GROUP"))
cmd3.Parameters .Add(New OracleParameter (":Original_ins t",
OracleType.VarC har, 10, "Inst"))
cmd3.Parameters .Add(New OracleParameter (":Original_PRI VS",
OracleType.VarC har, 37, "PRIVS"))
cmd3.Parameters .Add(New OracleParameter (":Original_fie ld",
OracleType.VarC har, 100, "field"))

cmd3.Connection = Conn
da.DeleteComman d = cmd3
Conn.Open()
da.Update(ds, "TW_GROUP_PRIVS ") <---- ERROR LINE

Getting the error on the final line here. The error being "ORA-010008: Not
all variable bound"

Any ideas on why this is failing?

Thanks in advance.
--
Kevin

--
Kevin
Nov 21 '05 #1
2 2800
Ksedran,

The answer is simple.

The removeat, removes a datarow completly from a dataset.
http://msdn.microsoft.com/library/de...oveattopic.asp

The delete set the rowstate from a datarow to deleted.
http://msdn.microsoft.com/library/de...eletetopic.asp
In the first situation there is nothing to delete in the database.

(You are not the first one)

I hope this helps

Cor
"ksedran" <ks*****@discus sions.microsoft .com>
I am having a "not all variables bound" issue when trying to delete a row
from a datagrid.

I have a datagrid populated with data from a oracle table as follows:

da = New OracleDataAdapt er("SELECT a.inst, a.group, a.privs,
b.field FROM table a, table b WHERE.......

da.Fill(ds, "TW_GROUP_PRIVS ")
da.datamember = "TW_GROUP_PRIVS ")
I have the insert and update statements working correctly, they are as
follows:

Dim cmd As New OracleCommand(" UPDATE TW_GROUP_PRIVS SET group =
:original_group , inst = :Original_inst, privs = :privs WHERE inst =
:original_inst AND group = :original_group ")

cmd.Parameters. Add(New OracleParameter (":original_gro up",
OracleType.VarC har, 30, "GROUP"))
cmd.Parameters. Add(New OracleParameter (":original_ins t",
OracleType.VarC har, 10, "Inst"))
cmd.Parameters. Add(New OracleParameter (":PRIVS",
OracleType.VarC har, 37, "PRIVS"))
cmd.Parameters. Add(New OracleParameter (":ORIGINAL_DES CRIPTION",
OracleType.VarC har, 100, "DESCRIPTIO N"))
Dim cmd2 As New OracleCommand(" INSERT INTO TW_GROUP_PRIVS
(group, inst, privs, description)
VALUES (:group_name, :institution_id , :privs, :field)")

cmd2.Parameters .Add(New OracleParameter (":group",
OracleType.VarC har, 30, "GROUP"))
cmd2.Parameters .Add(New OracleParameter (":inst",
OracleType.VarC har, 10, "Inst"))
cmd2.Parameters .Add(New OracleParameter (":PRIVS",
OracleType.VarC har, 37, "PRIVS"))
cmd2.Parameters .Add(New OracleParameter (":field",
OracleType.VarC har, 100, "field"))

cmd.Connection = Conn
cmd2.Connection = Conn
da.UpdateComman d = cmd
da.InsertComman d = cmd2
Conn.Open()
da.Update(ds, "TW_GROUP_PRIVS ")

I am running into issues with the delete portion of the code.

First, I remove the row from the datagrid:
if (Me.BindingCont ext(ds, "TW_GROUP_PRIVS ").Count > 0) Then
Me.BindingConte xt(ds,
"TW_GROUP_PRIVS ").RemoveAt(Me. BindingContext( ds,
"TW_GROUP_PRIVS ").Position )
end if

Now I want to delete the row from the source table:

'Dim cmd3 As New OracleCommand(" DELETE FROM TW_GROUP_PRIVS
WHERE
inst = :original_inst" _
&" AND group = :original_group AND privs = :original_privs and
description = :original_field ")

cmd3.Parameters .Add(New OracleParameter (":Original_gro up",
OracleType.VarC har, 30, "GROUP"))
cmd3.Parameters .Add(New OracleParameter (":Original_ins t",
OracleType.VarC har, 10, "Inst"))
cmd3.Parameters .Add(New OracleParameter (":Original_PRI VS",
OracleType.VarC har, 37, "PRIVS"))
cmd3.Parameters .Add(New OracleParameter (":Original_fie ld",
OracleType.VarC har, 100, "field"))

cmd3.Connection = Conn
da.DeleteComman d = cmd3
Conn.Open()
da.Update(ds, "TW_GROUP_PRIVS ") <---- ERROR LINE

Getting the error on the final line here. The error being "ORA-010008: Not
all variable bound"

Any ideas on why this is failing?

Thanks in advance.
--
Kevin

--
Kevin

Nov 21 '05 #2
Thanks Cor!!

That got me on the right track!
"Cor Ligthert" wrote:
Ksedran,

The answer is simple.

The removeat, removes a datarow completly from a dataset.
http://msdn.microsoft.com/library/de...oveattopic.asp

The delete set the rowstate from a datarow to deleted.
http://msdn.microsoft.com/library/de...eletetopic.asp
In the first situation there is nothing to delete in the database.

(You are not the first one)

I hope this helps

Cor
"ksedran" <ks*****@discus sions.microsoft .com>
I am having a "not all variables bound" issue when trying to delete a row
from a datagrid.

I have a datagrid populated with data from a oracle table as follows:

da = New OracleDataAdapt er("SELECT a.inst, a.group, a.privs,
b.field FROM table a, table b WHERE.......

da.Fill(ds, "TW_GROUP_PRIVS ")
da.datamember = "TW_GROUP_PRIVS ")
I have the insert and update statements working correctly, they are as
follows:

Dim cmd As New OracleCommand(" UPDATE TW_GROUP_PRIVS SET group =
:original_group , inst = :Original_inst, privs = :privs WHERE inst =
:original_inst AND group = :original_group ")

cmd.Parameters. Add(New OracleParameter (":original_gro up",
OracleType.VarC har, 30, "GROUP"))
cmd.Parameters. Add(New OracleParameter (":original_ins t",
OracleType.VarC har, 10, "Inst"))
cmd.Parameters. Add(New OracleParameter (":PRIVS",
OracleType.VarC har, 37, "PRIVS"))
cmd.Parameters. Add(New OracleParameter (":ORIGINAL_DES CRIPTION",
OracleType.VarC har, 100, "DESCRIPTIO N"))
Dim cmd2 As New OracleCommand(" INSERT INTO TW_GROUP_PRIVS
(group, inst, privs, description)
VALUES (:group_name, :institution_id , :privs, :field)")

cmd2.Parameters .Add(New OracleParameter (":group",
OracleType.VarC har, 30, "GROUP"))
cmd2.Parameters .Add(New OracleParameter (":inst",
OracleType.VarC har, 10, "Inst"))
cmd2.Parameters .Add(New OracleParameter (":PRIVS",
OracleType.VarC har, 37, "PRIVS"))
cmd2.Parameters .Add(New OracleParameter (":field",
OracleType.VarC har, 100, "field"))

cmd.Connection = Conn
cmd2.Connection = Conn
da.UpdateComman d = cmd
da.InsertComman d = cmd2
Conn.Open()
da.Update(ds, "TW_GROUP_PRIVS ")

I am running into issues with the delete portion of the code.

First, I remove the row from the datagrid:
if (Me.BindingCont ext(ds, "TW_GROUP_PRIVS ").Count > 0) Then
Me.BindingConte xt(ds,
"TW_GROUP_PRIVS ").RemoveAt(Me. BindingContext( ds,
"TW_GROUP_PRIVS ").Position )
end if

Now I want to delete the row from the source table:

'Dim cmd3 As New OracleCommand(" DELETE FROM TW_GROUP_PRIVS
WHERE
inst = :original_inst" _
&" AND group = :original_group AND privs = :original_privs and
description = :original_field ")

cmd3.Parameters .Add(New OracleParameter (":Original_gro up",
OracleType.VarC har, 30, "GROUP"))
cmd3.Parameters .Add(New OracleParameter (":Original_ins t",
OracleType.VarC har, 10, "Inst"))
cmd3.Parameters .Add(New OracleParameter (":Original_PRI VS",
OracleType.VarC har, 37, "PRIVS"))
cmd3.Parameters .Add(New OracleParameter (":Original_fie ld",
OracleType.VarC har, 100, "field"))

cmd3.Connection = Conn
da.DeleteComman d = cmd3
Conn.Open()
da.Update(ds, "TW_GROUP_PRIVS ") <---- ERROR LINE

Getting the error on the final line here. The error being "ORA-010008: Not
all variable bound"

Any ideas on why this is failing?

Thanks in advance.
--
Kevin

--
Kevin


Nov 21 '05 #3

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

Similar topics

1
4183
by: Junkguy | last post by:
I'm having difficulty deleting rows from a datagrid. I want to put a "delete" button on a form and achieve the same functionality as hitting the "delete" key on the keyboard for the selected row of a datagrid. I really want to do it generically so I have subclassed datagrid and made my own delete row method but I can only get it to work for datasources that are datatables or dataviews. Specifically when the datasource is a DataSet I...
5
14742
by: Mojtaba Faridzad | last post by:
Hi, with SetDataBinding( ) a DataGrid shows a DataView. user can select some rows in the grid by holding cotrol key. when user clicks on Delete button, I should delete all selected rows. I am trying to delete these lines from the dataview like this: for (int i=0; i < dataView.Count; i++) if (dataGrid.IsSelected(i)) dataView.Delete(i);
2
8228
by: Alex K. | last post by:
I am using datagrid bound to a datatable: DataTable dt = ...; MyGrid.DataSource = new DataView(dt); Now I am trying to intercept delete operation, when user highlights a row and presses delete key. For this, I am using dt.RowDeleting event: private void dt_RowDeleting(object sender, DataRowChangeEventArgs e) {
0
1414
by: Hrvoje Vrbanc | last post by:
Hello, this is a problem I came upon while building a site based on MCMS 2002 but it's not strictly MCMS-oriented: I have a page that displays a certain content in presentation mode but when an editor clicks "Switch To Edit Site" in MCMS console on the page, the page displays a different content, an interface that editor use for upload and deleting files on the web server. There are no problems with the upload but there is a problem...
4
1576
by: Lisa | last post by:
Hey all, I've spent an hour reading posts to see how to delete a row in a datagrid but none of them work for me (most are VB.NET and I'm coding in C#). Specifically, I have a checkbox next to each row and a "Delete" button at the bottom. What I want is for each row that is checked to get deleted on the click event.... this is what I got.. <asp:datagrid id="grdUpload" runat="server" DataKeyField="UploadID" AutoGenerateColumns="false"...
2
1722
by: NDady via DotNetMonster.com | last post by:
Hi, I have a datagrid populated from a dataset. On every row in the grid I have a delete button. When the user presses on the delete button I remove the row from the dataset and rebind the datagrid. The problem is that after a couple of delete the index in the dataset does not match the index in the grid and the wrong record i deleted from the dataset. How can I solve this Problem? I am using the following procedure: Private Sub...
0
956
by: Robert Batt | last post by:
Hello I have a problem deleting rows from a datagrid that is bound to a dataset. The datagrid updates and inserts just fin so the binding to the dataset must be ok. However when I try to delete a row from the grid it sometimes works and sometime gives an "index was outside the bounds of the array error". I have added a handler to determine when the dataset row is deleted as shown below any ideas what is going wrong Rober The grid is...
10
2346
by: Nick | last post by:
Hello, Please pardon my ignorance as I'm sure this is easy to do. I have a datagrid where I want to let the user delete columns. I added a context menu to the datagrid that has a delete option. If the user right clicks on a column heading can I highlight that column and then delete it? I'm not exactly sure how to highlight it or figure out what column has been clicked. In my testing so far when I use the context menu I always get the...
9
1739
by: Hamed | last post by:
Hello I have a DataGrid that a is bound to a DataTable. Some of the rows in the DataTable should not be deleted. How can I prohibit deleting of some identified rows? The problem could be specified in the following format too: There is a DataView object that I want to prohibit deleting of some of its DataRowView objects. that is: when drv.Delete() is called (drv is the
0
9480
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10324
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10147
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10090
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9949
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8971
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6739
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
3645
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2879
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.