vb.net - Input array is longer than the number of columns -


in event dragdrop of datagridview got error:

enter image description here

here's whole code of dragdrop event :

    private sub datagridview1_dragdrop(sender object, e system.windows.forms.drageventargs) handles datagridview1.dragdrop      dim clientpoint point = datagridview1.pointtoclient(new point(e.x, e.y))     dim hit datagridview.hittestinfo = datagridview1.hittest(clientpoint.x, clientpoint.y)      dim dgvr datagridviewrow = directcast(e.data.getdata(gettype(datagridviewrow)), datagridviewrow)     dim celldata object() = new object(dgvr.cells.count) {}     col integer = 0 dgvr.cells.count - 1         celldata(col) = dgvr.cells(col).value     next       dim dt new datatable()     dt = ds_data.tables(0)     dim colcheckbox datacolumn = dt.columns.add("column1", gettype(boolean))     dim row datarow = dt.newrow()     row.itemarray = celldata     dt.rows.insertat(row, hit.rowindex)      dgvr.datagridview.rows.remove(dgvr)     dim sqlcmd sqlcommand     sqlcmd = con.createcommand()     sqlcmd.commandtext = "update megatom_data_commande set ordre='" & hit.rowindex & "' id='" & datagridview1.rows(hit.rowindex).cells("id").value.tostring & "'"      try          sqlcmd.executenonquery()         datagridview2.datasource = ds_data2.tables(0).defaultview         datagridview1.datasource = ds_data.tables(0).defaultview         dim cmd new sqlcommand("plannifier")         cmd.parameters.add("@chaine", sqldbtype.varchar).value = cbochaine.selecteditem.tostring          executecmd(cmd)      catch ex sqlexception     end try end sub 

in fact datatable have 15 columns added manually checkbox column select rows think have problem of indexes dont know how resolve problem.

my ds_data defined code below:

   requestplanifie = "select megatom_data_commande.id id,numéro,observation,moule,commande,id_etat,programme,ordre,moule,glav,qté_commandée_totale," _        & " qté_coupée_cuir, qté_coupée_synthétique, qté_piquée, qté_finie megatom_data_commande" _ & " inner join dbo.megatom_data_moule on megatom_data_moule.id=megatom_data_commande.id_moule " _ & " id_chaine='" & cbochaine.text & "' , ( id_etat='3' or id_etat='4') order numéro asc,ordre asc"         dim dataadapter new sqldataadapter(requestplanifie, con)          try              dataadapter.fill(ds_data, "ds_data")             dataadapter2.fill(ds_data2, "ds_data2")         catch ex sqlexception           end try        datagridview1.datasource = ds_data.tables(0).defaultview 


Comments

Popular posts from this blog

how to proxy from https to http with lighttpd -

android - Automated my builds -

python - Flask migration error -