473,509 Members | 2,671 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Delete records in a data grid.

7 New Member
when I click the delete button ,display an error.
object reference not set to an instance of an object..
My code..
I use ASP.NET 2.0 (C#) and oracle
public void DeleteStore(Object sender, EventArgs e)
{
string dgIDs = "";
bool BxsChkd = false;
foreach (DataGridItem i in MyDataGrid.Items)
{
CheckBox deleteChkBxItem = (CheckBox)i.FindControl("DeleteThis");
if (deleteChkBxItem.Checked)
{

BxsChkd = true;
dgIDs += ((Label)i.FindControl("Label1")).Text.ToString() + ",";
}

}
string deleteSQL = "DELETE from employ_det WHERE emp_no =(" + dgIDs.Substring(0, dgIDs.LastIndexOf(",")) + ")";
if (BxsChkd == true)
{
try{}
catch (OleDbException err)
{
}

BindData();

}

}
Apr 12 '08 #1
0 716

Sign in to post your reply or Sign up for a free account.

Similar topics

4
1966
by: Belinda | last post by:
Hello All I need to read a SQL Server table into a Web Page and within the Web Page to permit my users to make changes to the records, delete or add new records and then save the entire contents...
2
11185
by: Joe Del Medico | last post by:
I have two tables A & B and I want to delete all the records in A that are not in B. Can I do this in the query builder? It seems like a simple problem. I can easily find the records in A that...
0
1692
by: 4 | last post by:
Insert/Delete/Modify Statement Shortcuts??? Help!! I am working in C# and running an Oracle 9i server. I was just wonering if there is a shortcut way of updating my tables and not have to...
1
4119
by: bie2 | last post by:
Hi, I have a datagrid with many records, I want to delete all of them. I'm doing CTRL-A and press delete...I take a long time to delete it and the UI is froze during that time. So I would...
3
2774
by: vcornjamb | last post by:
Hello, I am developing a web form that contains some buttons and a data grid which has as its last column link buttons that will delete the data associated with that row. Everything works fine,...
5
1394
by: Lisa Calla | last post by:
Hi, I need to display records with lots of fields. When placed in a grid, a row of data will scroll off the screen. Not exactly what I'm looking for. I've also used a datalist, which allows...
5
5627
by: Nick | last post by:
HI All: I have problem to delete row in grid view. It always needs to click twice delete button to delete row. but everytime it fires the deleting and deleted event. I have no idea why the...
0
1231
by: bdog4 | last post by:
I'm a bit new to asp.net and I'm trying to do very simple delete from a grid view but everytime I click on the delete link for the row it the page reloads and of course my row is still there. What...
2
2040
by: mady1380 | last post by:
Hi All I am new with Windows form. i am working on c#.net 2003. i have no idea how am i suppose to Edit, AddNew or Delete Record in DataGrid. I am passing a Dataset to my Grid. I want to...
2
3668
by: kurtzky | last post by:
i created a form that should function as follows: i will enter a number in a textbox..then it should query from the database all the records which has that number..these records will have a...
0
7233
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
7410
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...
0
7505
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
5650
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,...
0
4729
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
3215
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3201
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
774
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
440
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.