-
Do you want to display the data queried from one table according to the criteria in the datagrid, and after the modification is completed, click the OK button to transfer the data to another table, and then delete the data in the original table, right?
The above ** should be filled in the query button, and after clicking, the data that needs to be modified will be investigated and dealt with according to the conditions.
Define the ADO object outside of the sub, i.e., define the common ADO object.
Define two result sets:
dim rs1 as new
dim rs2 as new
The data in rs1 is the data that is searched conditionally, and the SQL statement executed by rs2 is used"select * from zuizhong"
After the data is reviewed, click the Save button, save the modification results in the DataGrid in the original database (, and then RS1 executes the SQL statement (MSSQL) for query again, and add the data in RS1 to RS2 (; "xuehao")="Student ID")……Finally, delete the data in RS1 (
Hehe, I hope it helps.
Addendum: Hehe, you may overestimate the function of datagrid, although datagrid has the function of modifying data, but when doing database programs, we never use its function, because it is extremely insecure. Besides, you can't disconnect table A without updating the data, reconnect the datagrid to table b, it should be that at the same time as the reconnection, the data in the datagrid will also change, you can only read out the records in the datagrid one by one and add them to the zǔ table, but the data in the datagrid is more cumbersome to read, so my suggestion is:
1.After modifying the data, it is directly saved to the original table.
2.Add the modified data from the original table to the final table.
3.Deletes data from the original table.
If you still have questions, you can send me the project and I will help you change it, or I will make an example and send it to you.
-
dim cn as new '* Database connection dim rs as new'* Database record dim mssql as string
private sub form load()*Connect to the database source.
aduseclient
provider=;" &
data source=" & "\"
mssql="select * from luru"
mssql, cn, adopendynamic, adlockpessimistic
set = rs
end sub
private sub cmdok_click()if <>0 then
do while not
mssql ="insert into zuizhong(xuehao,xingming,xingbie,chushengnianyue) values('" & rs!xuehao & "','" & rs!xingming & "','" & rs!
xingbie & ','" & rs!chushengmianyue & "')"
mssqlloopmssql="delete from luru"
mssqlend sub
-
It's so professional, I get dizzy to watch.
The boss is really a master.
-
Set the DataGrid data source to adodb
-
Use a for loop to inert each row of data into Table 2
-
Write the data to another table.
insert
-
Set the datagrid data format.
-
There is no problem with statements, as long as there is data in the time period.
The generated installation file is fully installed on the new computer. And in your native there is a development environment.
-
The key is:
set = recordset.
-
How do you inquire, post ** out and see for you to change.
-
The following form is designed, including the following controls, a label;
The property of a text is empty; A command whose caption is a query; A data control whose databasename attribute value is the specific location of the database; An MSSflexGrid control with a datasource property value of data1
private sub command1_click()= "select * from (table name) where (field name) ='" & "'"
if then
a = msgbox("End of inquiry! ")
(Field Name)."
end if
end sub
-
You don't need to ** at all, you use a datagrid "aftercolupdate" event and add a sentence "msgbox" in the process"Update Success! ""Your library will be updated with DataGrid! I've used it n times!
Appears memory can not be"read"There are many reasons, try to use the following methods to patiently eliminate them. >>>More
4. Effectively increase the effective supply of housing. In cities where housing prices are too fast, it is necessary to increase the total amount of residential land. Conscientiously implement preferential tax policies to support the construction of public rental housing. >>>More
The northern geese and the southern geese are migratory birds, and when the northern is in late autumn, the geese fly to the warm south. The cold cicadas no longer call or whisper, and the sound is desolate and sad, symbolizing the late autumn season. Example: >>>More
It mainly talks about the author's inadvertent loss of time, and warns us to cherish time and not waste a minute or a second! >>>More
If you accidentally delete the files, chat history, and contacts stored in the internal memory without backing up the data in advance, the deleted files and contacts cannot be recovered. Therefore, it is recommended that you carefully delete the data on your phone, and back up your files in time if possible, so as to avoid the loss of important data and cannot be retrieved.