469,307 Members | 2,124 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,307 developers. It's quick & easy.

use GridView1_RowDeleting in visual studio 2008 with odbc mySQL

i want to use gridview... and i want to select, delete, upadate the data in the gridview.. my friends ask to use rowdeleting... but i dont know how to bulid it.. i also use mysql ODBC 5.1 driver as my mySQL connector...

here some codes that i have use :

the BindGrid(), is i use to view the data to the gridview.. it also not work..

Protected Sub BindGrid()

Dim da As OdbcDataAdapter
Dim ds As DataSet
Dim str3 = "select * from student_kaum"
Dim conn3 As OdbcConnection
conn3 = New OdbcConnection("datasource=localhost;database=stud entregistration;uid=root;pwd=")
'Dim DBCon As New Odbc.OdbcConnection
'Dim DBAdd As New Odbc.OdbcCommand

'DBCon.ConnectionString = ConfigurationManager.ConnectionStrings("Connection String").ConnectionString
'DBAdd.Connection = DBCon
da = New OdbcDataAdapter(str3, conn3)
ds = New DataSet()
da.Fill(ds, "eid")
GridView1.DataSource = ds

End Sub

Protected Sub GridView1_RowDeleting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GridView1.RowDeleting

'string Email = gvUsers.Rows[e.RowIndex].Cells[1].Text;
Dim eid As Integer = GridView1.DataKeys(e.RowIndex).Item("eid")
Dim DBCon As New Odbc.OdbcConnection
Dim DBAdd As New Odbc.OdbcCommand

DBCon.ConnectionString = ConfigurationManager.ConnectionStrings("Connection String").ConnectionString
DBAdd.Connection = DBCon

DBAdd.CommandType = CommandType.Text

DBAdd.CommandText = "delete from student_kaum where ('" & Me.GridView1.DataKeys(e.RowIndex).Item("eid") & "') = (eid)"



if someone can help me... thank u...
Jun 29 '10 #1
0 1470

Post your reply

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

Similar topics

2 posts views Thread by =?Utf-8?B?SmFzb24gQS4gSmVuc2Vu?= | last post: by
9 posts views Thread by =?Utf-8?B?RmxhdmVsbGUgQmFsbGVt?= | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by harlem98 | last post: by
1 post views Thread by Geralt96 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.