473,394 Members | 1,812 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

wats wrong in this code for deleting a row frm datagrid...

111 100+
Hii all,

im worried with a project where...

im trying to delete a row from the datagrid....


Expand|Select|Wrap|Line Numbers
  1.  
  2. delete_button_click:...
  3.  
  4.  Dim index As Integer
  5.         Dim rowcount As Integer
  6.  
  7.  
  8.         For rowcount = 0 To myDS.Tables(0).Rows.Count - 1
  9.  
  10.             Dim dr As DataRow
  11.             dr = myDS.Tables(0).Rows(index)
  12.  
  13.             If MessageBox.Show("Are you sure", "Delete", MessageBoxButtons.YesNo) = DialogResult.Yes Then
  14.  
  15.                 dr.Delete()
  16.                 myDS.Tables(0).AcceptChanges()
  17.                 index = index - 1
  18.  
  19.             End If
  20.  
  21.  
  22.             Dim cmSQL As New MySqlCommand
  23.             Dim conSQL As New MySqlConnection
  24.  
  25.             If (conSQL.State = ConnectionState.Closed) Then
  26.                 conSQL.ConnectionString = connect.ConnectionString
  27.                 conSQL.Open()
  28.                 Dim strSQL As String = "DELETE ch_child_name, ch_date_of_birth, ch_blood_group, ch_child_standard, " & _
  29.                 " ch_child_gender, ch_child_standard_year, ch_worker_code " & _
  30.                 " FROM tbl_child_details WHERE ch_child_name = myDS.Tables(0).Rows.rowcount "
  31.  
  32.                 cmSQL = New MySqlCommand
  33.                 cmSQL.Connection = conSQL
  34.                 cmSQL.CommandText = strSQL
  35.                 cmSQL.ExecuteNonQuery()
  36.  
  37.             End If
  38.  
  39.         Next rowcount
  40.         index = index + 1
  41.  
  42.         Me.Close()
  43.  
  44.  

im aint getting any exception....but the row is not getting deleted.........

plz some one help...
thnxx..
hepsi..
Aug 10 '07 #1
1 989
kenobewan
4,871 Expert 4TB
Its not getting deleted in the db, datagrid or both?
Aug 10 '07 #2

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

Similar topics

2
by: Job Lot | last post by:
My DataGrid is bound to DataView as follow DataGrid1.DataSource = myDS.Tables("Client_Consultant").DefaultView User can either delete all the rows in the DataGrid on by pressing "Delete All"...
7
by: Rajani | last post by:
Hello, dim receiptto receiptto="a2z@yahoo.com" set cdoconfig=CreateObject("CDO.configuration") set cdomsg=CreateObject("CDO.Message") with cdoconfig.Fields...
1
by: hitendra | last post by:
wats eauivalent of IIF in C#?
2
by: rodchar | last post by:
hey all, i've got an asp.net page with a datagrid on it. when i delete all the rows in the datagrid it just shows the column headers. how are some ways i can clean that up? thanks, rodchar
1
by: fiaolle | last post by:
Hi The first set of source code is the class for a combobox in a grid, hopefully. In the second set of code we try to use the combobox class, but the grid is empty. I don't understand how this...
2
seshu
by: seshu | last post by:
Hi everybody today i have developed an application which uses the concepts of classes and the code is like this to explain you simply i have two forms form1,form2,and a class class1 in class i...
0
by: Nishit | last post by:
wats the difference between debuggin and compiling?
3
navanova
by: navanova | last post by:
hi guys, I'm developing an application using vb.net and sql server 2000. the data in the database are shown on the form using datagrid. I want to delete a single row from the datagrid as well as from...
4
by: looserash | last post by:
hi, Can anyone please help me solve the problem m facing with the datagrid. I want to delete a row in the datagrid and correspondingly i want that data to be deleted in database . thanks,
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
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...
0
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
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
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
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...

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.