iran_sky
سه شنبه 17 فروردین 1389, 00:05 صبح
با سلام به دوستان
من با این کد میخوام اطلاعات داخل بانک رو پاک کنم اما خطا syntax میده مشکلش کجاست
Private Sub btn_delete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_delete.Click
Try
cmd.Connection = conn
cmd.CommandText = "delete * from notebook where telephone=@telephone"
cmd.Parameters.AddWithValue("name", Trim(txt_name.Text))
cmd.Parameters.AddWithValue("lastname", Trim(txt_lastname.Text))
cmd.Parameters.AddWithValue("telephone", Trim(txt_telephone.Text))
cmd.Parameters.AddWithValue("address", Trim(txt_address.Text))
conn.Open()
cmd.ExecuteNonQuery()
conn.Close()
MessageBox.Show(" ")
txt_name.Text = ""
txt_lastname.Text = ""
txt_telephone.Text = ""
txt_address.Text = ""
DataGridView1.AutoGenerateColumns = True
ds.Clear()
dta.Fill(ds, "notebook")
DataGridView1.DataSource = ds
DataGridView1.DataMember = "notebook"
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
من با این کد میخوام اطلاعات داخل بانک رو پاک کنم اما خطا syntax میده مشکلش کجاست
Private Sub btn_delete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_delete.Click
Try
cmd.Connection = conn
cmd.CommandText = "delete * from notebook where telephone=@telephone"
cmd.Parameters.AddWithValue("name", Trim(txt_name.Text))
cmd.Parameters.AddWithValue("lastname", Trim(txt_lastname.Text))
cmd.Parameters.AddWithValue("telephone", Trim(txt_telephone.Text))
cmd.Parameters.AddWithValue("address", Trim(txt_address.Text))
conn.Open()
cmd.ExecuteNonQuery()
conn.Close()
MessageBox.Show(" ")
txt_name.Text = ""
txt_lastname.Text = ""
txt_telephone.Text = ""
txt_address.Text = ""
DataGridView1.AutoGenerateColumns = True
ds.Clear()
dta.Fill(ds, "notebook")
DataGridView1.DataSource = ds
DataGridView1.DataMember = "notebook"
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub