Jump to content
ludgero1993

datagridview erro alguem me ajude

Recommended Posts

ludgero1993

Dim x As Integer
	For x = 0 To DataGridView1.Rows.Count - 1
		Dim idcargo As String = DataGridView1.Rows(x).Cells(0).Value
		Dim nomedocargo As String = DataGridView1.Rows(x).Cells(1).Value

		SqlQuery = "Insert into Cargo ([iD_Cargo],[nome_do_cargo]) Values (@ID_Cargo, @nome_do_cargo)"
		Dim com As New OleDb.OleDbCommand(SqlQuery, conn)
		com.Parameters.AddWithValue("@ID_Cargo", idcargo)
		com.Parameters.AddWithValue("@nome_do_cargo", nomedocargo)
		com.ExecuteNonQuery()


	Next

nao me deixa sequer escrever na celula para escrever da erro imediato no com.ExecuteNonQuery() alguem me pode ajudar ssf

Edited by Rui Carlos
Formatação do código.

Share this post


Link to post
Share on other sites
Leonardo Pereira

Mas e entao nao deve ser este código , tenho ideia que o cellendedit só acontece quando mudas de célula. Confirma por favor

Share this post


Link to post
Share on other sites
acao

boas

mas já fizes-te o teste?

ante de: «com.ExecuteNonQuery( coloca «conn.open()»

cumps

acao

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.