C Query the database multiple times, C Operate the database multiple times in the program, and open

Updated on technology 2024-05-24
23 answers
  1. Anonymous users2024-02-11

    Violating the principle of opening and closing... You can spell out the string as m978718484 says and then do the in operation, or you can "select col from table where key=1 union select col from table where key=2.""union is faster than iterating through the database, and it's a single execution.

  2. Anonymous users2024-02-10

    You take out the data in the arraylist loop, put it in the string, use it, separate, and then use in when you look it up, which will be faster, and the interaction with the database will be reduced.

  3. Anonymous users2024-02-09

    First, use the query tool that comes with the database itself to execute your query statement to see if there are any errors.

  4. Anonymous users2024-02-08

    If it is a web program, frequent opening and closing cannot be avoided, because the access requirements initiated by each client are different, if the program starts to open the connection uniformly, and closes the connection when it is closed, it will cause the occupation of database system resources and affect the client's access to server resources.

  5. Anonymous users2024-02-07

    No, there's something called a connection pool, so let's find out!

  6. Anonymous users2024-02-06

    1. There is little data, you can do anything, and it has little impact on the speed (mainly because you can't feel it).

    2. There is a lot of data, multi-table connection query is faster than multiple queries, multiple queries need to call classes many times to operate, and multi-change connection queries, only need to call classes once, but in both cases, it takes a certain amount of time, it is recommended to use thread rest commands when querying, give hints, etc., so that query design is more humane.

  7. Anonymous users2024-02-05

    The conditions are too vague, how many tables, how many times to access the database! And how big your database is, if it's very small, it doesn't make much difference!

  8. Anonymous users2024-02-04

    Hehe. According to your will. I recommend you to look it up with a statement.

    Database links are invaluable. It's mainly a matter of SQL optimization. I once wrote a sql to solve a problem.

    It takes a minute to get results. Write in two. Just over 2 seconds.

  9. Anonymous users2024-02-03

    Do you mean that you have multiple visits to find out some of the data first, and then filter it according to the criteria?

    I think unless you have a very large amount of data, or a statement multi-table join query, if your data is so large that it takes longer than multiple connections, then connect multiple times, test it and get your answer.

  10. Anonymous users2024-02-02

    If you read it without modification. Data can be read out and cached.

    Write frequently. You can splice multiple statements of a statement. A sex is passed into the database.

    Multiple statements are executed. Database transactions are turned on. This will be more efficient.

  11. Anonymous users2024-02-01

    string sql=select count(*)from table where condition='';

    Then write a method that returns a single number, and then the foreground adjusts the method and displays it in the textbox

  12. Anonymous users2024-01-31

    Join as a sqlserver database:

    using ;

    using ;

    sqlconnection conn = new sqlconnection(connectionstring);

    sqlcommand cmd = new sqlcommand("secelt * from userinfo", conn);

    sqldataadapter sda = new sqldataadapter(cmd);

    dataset ds = new dataset();

    table");

    return "table"];A datatable is returned

  13. Anonymous users2024-01-30

    dataset ds = new dataset();

    datatable dt = new datatable();

    dt = ;In this case, there is no datatable in the dataset, so an error will be reported here.

    change to dataset ds = new dataset();

    datatable dt = new datatable();

    Or put. dataset ds = new dataset();

    dt = ;

    These two sentences are commented out, and then ; Changed to;

  14. Anonymous users2024-01-29

    You mean a lot of basic data, which should be used a lot of data and don't change much. It's better to keep this data in memory, which is quick to access and doesn't require frequent database connections.

  15. Anonymous users2024-01-28

    It depends, the memory is limited but the speed is fast, and the database is large but the speed is slow.

    Just like the relationship between CPU and memory, memory and hard disk, it all depends on your practical application.

  16. Anonymous users2024-01-27

    In the actual program design, to analyze the reading frequency of this data, but also consider the carrying capacity of the server, improve efficiency is king.

    The reading frequency is high, and the frequency of use is also high, and the basic data is generally loaded and used many times at one time (filtering, reprocessing, etc.), so it is recommended to save it in memory.

    Stored in the database takes a long time to read, and if the number of concurrent transactions is high, it will affect the efficiency even more.

  17. Anonymous users2024-01-26

    It depends on how much data you use, how much you use it, and how long you use it, if you use it multiple times in a short period of time, it is recommended to save it to memory, and if you don't use it very frequently, then access the database every time.

  18. Anonymous users2024-01-25

    If it's data that is used frequently and the memory is sufficient, putting it in memory can improve efficiency and reduce the pressure on the database.

  19. Anonymous users2024-01-24

    It can't be so simple!

    First of all, it depends on whether the data you cache needs to be queried intervals.

    Then look at the amount of data cached.

    If you do not need to query between regions, no matter how large the amount of data is, it is fast to put it in memory, if you need to query between sections and the amount of data is not large (for example, below 10,000 levels), it is still fast to put it in memory, and if the data volume is large (such as more than 10,000 levels), it is still fast to put it in the database.

    Because in terms of big data processing power, c ** is far inferior to the database!

  20. Anonymous users2024-01-23

    Millions of data, preferably with less access to the database.

    Below millions, you can do so by querying the database.

  21. Anonymous users2024-01-22

    If the server is good, it is recommended to read the database.

  22. Anonymous users2024-01-21

    Your question is too general, let me think about it:

    Use C to call a query: select count(*)from your table where your field = the value you are looking for, use the executescalar method of the sqlcommand object to adjust, if the return value is greater than 0, it means that the value exists in the database, then you can prompt the repeat in the way you need.

  23. Anonymous users2024-01-20

    What do several values of the same field mean, and what are the characteristics, you can use SQL statements to achieve them, such as select field name from table name where condition, where the condition is determined according to the value you want to query, such as like, in, etc.

Related questions
5 answers2024-05-24

Try to capture the return value.

22 answers2024-05-24

Author: Xiao Kuan] private void restore().

string path = recovery path. text;Obtain the backup path and database name. >>>More

9 answers2024-05-24

using ;

using ; >>>More

15 answers2024-05-24

1.Create a socket

2.Determine the local computer endpoint (IP and port number). >>>More

13 answers2024-05-24

I've just started learning this!