Click here to Skip to main content
15,887,746 members
Please Sign up or sign in to vote.
1.80/5 (2 votes)
See more:
Hi I have two datagrid view

1 is like this
col1 col2
1 a
2 b
3 c
4 d

2is like tihs
col1 col2
1 50,00
2 70,00
3 21,00
4 32,00

so i want first datagridview like this

col1 col2
a 50,00
b 70,00
c 21,00
d 32,00

can you help for this problem
thanks

What I have tried:

i tried for next two data gridview but i have error
Posted
Updated 12-Sep-19 3:49am

1 solution

You could use DataBinding, see example here: https://www.dotnetperls.com/datagridview-vbnet[^]
Then use a DataTable with all columns in it as the DataGridView1.DataSource.
 
Share this answer
 
Comments
Member 14588284 12-Sep-19 8:09am    
thanks for return
I get both tables from the oracle connection
but I need to match the columns over two tables after the query.
I read the article but could not find anything related to my question
RickZeeland 12-Sep-19 8:27am    
Then you need a SELECT something like this:
SELECT a.name, b.value FROM myTable1 a INNER JOIN myTable2 b WHERE a.id = b.id;
Also see: https://www.techonthenet.com/oracle/alias.php
Member 14588284 12-Sep-19 8:37am    
can i use datagridview in query?

i say , when i use join in my oracle query time is getting longer
RickZeeland 12-Sep-19 9:44am    
Then your tables are quite big probably, you should index them on the field that you want to use in the WHERE clause.
Member 14588284 12-Sep-19 8:24am    
my code like this

and error is this address
https://yadi.sk/i/4tMuaDzBZLyZ-g

With Me.reyon
' .Columns(0).DefaultCellStyle.Format = "#"
Try
For i = 0 To .Rows.Count - 1

For i2 = 0 To reyonadıfrm.Rows.Count - 1
If .Rows(i).Cells(0).Value = reyonadıfrm.Rows(i2).Cells(0).Value Then
.Rows(i).Cells(0).Value = reyonadıfrm.Rows(i2).Cells(1).Value
End If

Next i2


Next i

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900