Regarding vb database query, VB 6 0 database query code will not, ask for advice!

Updated on technology 2024-04-14
5 answers
  1. Anonymous users2024-02-07

    1.You may be missing the database connection statement of adodC1, and only the SQL statement.

    provider=;data source=e:\;persist security info=false"

    That is, the connectionstring property of adodc1 is not set.

    2.** One sentence is missing.

    Update the query.

    If your database is an access database, you can do the following:

    When creating a new project, select Data Engineering, and the toolbox on the left of the VB6 integrated debugging environment is loaded with the necessary controls for database programming.

    Then add the ADODC control and the DataGrid control in the form1 form, select ADODC1 for the DataGRID1 attribute datasource, open the ADODC1 control property page to use the connection string, select Generate, select Microsoft Jet OLE DB provider for access database in the provider options, and then connect to the database as required. In the ADODC1 control property page, there is a long string of strings in the blank text window, note that this string can be copied to the program for programming. The data source of the ADODC1 control property page has a command text (SQL) writing window that can be used to write SQL query language.

    The SQL statements of this window can be copied to the program ** for programming.

    The main structure of SQL query language is as follows:

    select query field from table name where query condition statement [sort statement or grouping statement].

    Query fields must be separated by a comma or replaced by an asterisk, and the sort statement in the above query is best used.

    If there is an error in the SQL query language, you can make changes to it when the program is running. I generally follow the above connection first, SQL use"select * from tabelname"For debugging, no problem, use a button portware to copy the aforementioned connection string and SQL query language in the click event of the button control first, so that you can use it later. Then delete the adodc1 hole, add the adodc1 control, and add other content.

    For detailed engineering documents, please refer to:

    Upload attachments.

  2. Anonymous users2024-02-06

    ADODC SQL statements are concatenation statements.

    private sub command1_click()= "select * from test where dh=10"

    end sub

    It only comes back to work when the file is set and the module is connected.

    VB Programming in ExcelD's module

  3. Anonymous users2024-02-05

    1. First open the Visual Studio 2008** window and add references.

    2. Enter the following **:p ublic conn1 as sqlconnection = new sqlconnection.

    3. Declare the keyword public; Good blind dude (because it's a global variable.)

    So use public to sound friends).

    4. If the SQL database is locally, connect with the following **.

    5. If ** is too long and affects readability, you can add it with a space"_"After that, just enter and wrap lanes.

  4. Anonymous users2024-02-04

    The following ** is based on the following 4 assumptions:

    1. The names of the controls are:

    3 text boxes from top to bottom: text1, text2, text3

    The ADO control is named ADODC1 and the grid control is named DataGrid1

    2. According to the ** you gave, the field [Steel Grade] is the character type, and [Outer Diameter] and [Wall Thickness] are numeric types.

    3. Your database file is named "Database." mdb" and has been saved in the same folder as the project files.

    4. The data sheet you are using is named "Steel Data Table".

    Then, in the click event of the [Query] button, write the following ** to achieve your requirement:

    provider=;data source="& Databases. mdb;persist security info=false"

    select * from Steel Data Sheet where Steel Grade='"& and OD="& and wall thickness ="

    if not ( and then

    set = adodc1

    elsemsgbox "Didn't find it! "

    end if

  5. Anonymous users2024-02-03

    This is a question that makes people feel so helpless, and I tell you from the eyes of a non-expert.

    1. rs,,,cn is the function of this cn object after you set cn=**. The same is true of RS. You should say. , and what is the difference between these two things?

    2. Is it every time you access the database, rs and cn need to be closed, I feel that this problem is a bit strange, once this rs or cn is set to a certain object, it will carry the object on its back, do not put down the old one, it will not be able to carry the new one, back two things, it will be tired and unbearable, it will shout "error". I don't know if you can understand that.

    3. connection is an excut command, right? I can't remember clearly, let's set it for the time being, after it connects to the library, it doesn't return a value. RecordSet is open and has a return value.

    Details of this, you go down, who is good at the cover, depending on your needs, generally used. It is convenient for specific operations later. Of course, excut is also possible.

Related questions
3 answers2024-04-14

Well, with ADO, you can directly select and output to excel, for example, insert into [excel; database='c:\''sheet1$''(Field 1, Field 2,...)from .. >>>More

2 answers2024-04-14

1. Create an access database and create a new table in the database—that is, an additional table. By setting the property values of the attached table, make it linked to the database you want to access. >>>More

16 answers2024-04-14

resultmap="loginuser"Wrong should be resultmap="user"There is also such a write,The SQL that is tracked out is in the form of a stored procedure,Compare egg pain,select userid, username, password from t user where username= username and password= password Personally like select userid, username, password from t user where username=‘$username$' and password=‘$password$'

8 answers2024-04-14

It can be used normally after plugging in the USB flash drive, but there is no icon in the taskbar to safely delete the hardwareI don't know how to fix it, here is a share of the fix. >>>More

10 answers2024-04-14

The database is generally composed of many tables, for example, the school builds a database, which can build a student table (including the student's name, age, student number, class, date of birth), a teacher table (including the teacher's name, age, teaching class, teaching category), a report sheet (including the student's student number, and the grades of each subject), etc. These are the ways in which the files are stored in the database, and try to make sure that the items in a table are closely related and have the same attributes, if this condition cannot be met, a table must be built (the redundancy of the built table has 4 levels). In order to meet the user's query needs, we also need to make a number of views, for example, you can make a view of his items have the name of the student, age, grades of each subject, and the teacher of each subject, etc., we can also export new items according to the existing items, for the purpose of simplicity, for example, the view can add an average grade, we add different permissions and roles to each view, and provide it to different people to query to protect the security of the database. >>>More