Jump to content
HIGKILLER

Erro em update?

Recommended Posts

HIGKILLER

Private Sub din_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles din.Click

Dim x = DataGridView1.CurrentRow.Index

Dim y = DataGridView1.Item(1, x).Value

Dim u = DataGridView1.Item(2, x).Value

Dim z = DataGridView1.Item(3, x).Value

nome.Text = y

tele.Text = u

mail.Text = z

Dim con As OleDbConnection

Dim com As OleDbCommand

' com = New OleDbCommand("insert into cliente (Nome, bi) values(@Nome,@bi)", con)

con = New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\Orlando\Desktop\family butchers\clientes.accdb")

com = New OleDbCommand("update Cliente set din = @din, where ID = @z", con)

con.Open()

com.Parameters.AddWithValue("@Nome", nome.Text)

com.Parameters.AddWithValue("@tele", tele.Text)

com.Parameters.AddWithValue("@mail", mail.Text)

com.Parameters.AddWithValue("@din", abc.Text)

com.Parameters.AddWithValue("@z", DataGridView1.Item(0, x).Value)

com.ExecuteNonQuery()

' MsgBox("Cliente Adicionado")

con.Close()

nome.Clear()

tele.Clear()

mail.Clear()

'MsgBox("algo correu mal")

refreshDataGrid()

' End Try

End Sub

O que estou a tentar fazer é apanhar os dados (nome email e telefone) e atualizar 1 unico campo, de forma a nao modificar nada mais, mas estou a ter um erro que nao consigo bem decifrar, obrigado por qualquer ajuda

Share this post


Link to post
Share on other sites
vikcch

O erro no update é a virgula, não podes ter virgula antes do WHERE...

UPDATE Cliente SET din = @din WHERE ID = @z

O resto não percebi o que queres fazer....

Share this post


Link to post
Share on other sites
HIGKILLER

e qual é o erro?

No update mas já vi o erro, obrigado de qualquer forma

No update mas já vi o erro, obrigado de qualquer forma

Obrigado, e algo meio aldrabado

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.