| |

VerySource

 Forgot password?
 Register
Search
View: 837|Reply: 7

Ask a question, also about DATAGRiD

[Copy link]

1

Threads

4

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

Post time: 2020-1-6 18:20:01
| Show all posts |Read mode
My program needs to add the data from the first DATAGRiD query to the second DATAGRiD. How do I write the program code?
Reply

Use magic Report

0

Threads

7

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2020-1-7 11:24:01
| Show all posts
set datagrid1.datasoucre = adodc1.recordset
set datagrid2.datasouce = datagrid1.datasource
I wonder if you mean this
Reply

Use magic Report

1

Threads

4

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

 Author| Post time: 2020-4-24 15:00:02
| Show all posts
no

I want to add the data from the first DATAGRID that has established a data connection to the second DATAGRID that has not established a data connection. Should I create an ADODB.recordset for the second DATAGRID that has not established a data connection?
Reply

Use magic Report

0

Threads

10

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 China

Post time: 2020-4-26 22:15:01
| Show all posts
Both DATAGRiD can be assigned the same data source. If you don't want to, copy the first DATAGRiD data traversal to the second DATAGRiD. :)
Reply

Use magic Report

1

Threads

4

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

 Author| Post time: 2020-7-17 21:00:01
| Show all posts
I want to be able to selectively add the data in the first DATAGRID that has established a data connection to the second DATAGRID

I didn't make it clear...
Reply

Use magic Report

0

Threads

5

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 China

Post time: 2020-7-20 13:00:01
| Show all posts
If you want to see the final result~ it is OK to directly improve the query statement
If you want to save, you can add the result of DATAGRID1 to the data table of 2
If the columns are not the same, use another table to save, or add columns
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-7-20 14:45:01
| Show all posts
You try it, easy to use, dynamically change the data in datagrid
Remember to quote ado
You only need to include miscrosoft Activex data objects 2.x library in the project/reference
Dim Db As Connection
Dim WithEvents adoPrimaryRS As Recordset'database connection object
Private Sub Command1_Click()
   

   strsql="select field from table where your condition"
   Set Db = New Connection
   Db.CursorLocation = adUseClient
   'You need to modify the following connection data string
   Db.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&App.Path&"\plan management system.mdb;Persist Security Info=False"
   Set adoPrimaryRS = New Recordset
   adoPrimaryRS.Open strsql, Db, adOpenStatic, adLockOptimistic
   Set DataGrid1.DataSource = adoPrimaryRS
end sub
Reply

Use magic Report

1

Threads

4

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

 Author| Post time: 2020-8-3 12:45:02
| Show all posts
Thanks a lot
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list