-
Build a module.
Set the project's startup to sub main
Write the following in the module.
public db as databasepublic rs as recordsetsub main()
set db="Database path""It is recommended to use a relative path -- that is, to put the database file and the project file in the same directory -- the relative path is"The database name is suffixed">)
The first launch form "For example: form1>showend sub
Later, if you want to call the database in other forms, you can only write **set rs=openrecordset("It can be a table of the database -- such as"student", which can also be a query statement -- such as:"select* form student">)
In this case, the contents of the database are stored in the file collection.
Let's say set rs=openrecordset("select* form student")
This is the first column of the SQL statement query result.
It's the whole result.
Use it to help set the text box in the query result.
If you want to repair the database, use the following **:().
-
You can open it after writing and enter it into the datagrid.
The datagrid can be modified.
dim rstf as new
select * from t_zhuanxian") to text.
-
I don't understand what it means, if you don't want to enter data in text, set the readonly attribute of text to true
-
Fantastic question ...
There is a raised hand that can be understood.
-
If it's just a field value:
If there are multiple fields: the property should be set to true, private sub command1 click()dim finddata(2) as stringfinddata(0) ="data1"
finddata(1) = "data2"
finddata(2) = "dfas3"
finddata(0) +space(3) +finddata(1) +space(3) +finddata(2) +space(3)
end sub
-
strsql = "select * from data table name order by id"
strsql, db, 2, 2
Field 1, Field 2
Close the recordset object.
set rs = nothing
-
Write to database:"insert into values('" & "')"Previous Record: ("field"db is the connection object and rs is the recordset object.
-
Open the database in VB first, and then write SQL statements to query data, if the calculation is simple, you can use SQL to directly find the calculation result and assign it to the text control, if the calculation is complex, you can use ** to control.
-
Use summation queries.
SQL statement: select sum(field name) as field alias from table name.
The simplest way is to set the data source of the data control to this SQL statement, and then connect the text control to this data control, and the field name is the field alias.
Or use the reference ado, press this sql to open the dataset, and use fields(0) or field aliases to reference this field to assign the value to the text control.
-
Add the ** below and try it:
select * from User Information Table where username if > 0 then
Name"Student number")
Classes"Eliminate the wide e-mail address and take it on")
elsemsgbox "None of this user makes the message "end if."
-
select ** , count (*as cc from a group by **。
if (result set!) **=15) then= Result set! cc
end if
Rabbits are mainly herbivores, vegetables should be moderate and not too much, rabbit food is also a certain amount a day, rabbit grass is unlimited! I also raise rabbits, I recommend paying attention to the back garden of the rabbit bar on Sina Weibo, and it seems that there is also a post bar, and it is very good to raise rabbits. **Buy rabbit supplies?! >>>More
1. You can eat grapes when you have a cold.
2. It is suitable to eat grapes for colds, because it contains sufficient water and potassium, which can replenish the water and potassium lost due to colds. >>>More
Dogs are not allowed to drink milk.
Because most dogs are lactose intolerant, milk is relatively high in lactose, and lactose intolerant dogs can cause diarrhea when they eat milk. >>>More
Potatoes are perfectly fine to eat raw!
It is completely possible to shred the potatoes and blanch them in hot water, the purpose is to remove the starch, so as not to eat the sticky mouth, mainly because the potatoes are rich in starch. >>>More
It doesn't hurt to eat less, but eating more is harmful to the human body. >>>More