A
A
Andrey Fomin2021-02-11 19:21:01
SQLite
Andrey Fomin, 2021-02-11 19:21:01

How it is possible to transfer the table to the server?

Hello!
I had an application with a form that had the ability to pull a table from a database using this code:

private void button1_Click(object sender, EventArgs e)
        {
            SQLiteConnection conn = new SQLiteConnection("Data source = accounts.db");
            conn.Open();

            SQLiteDataAdapter dataAdapter = new SQLiteDataAdapter($"SELECT * FROM PaymentHistory WHERE Otpravitel = '{LoginField.Text}' OR Poluchatel = '{LoginField.Text}'", conn);
            DataSet ds = new DataSet();

            dataAdapter.Fill(ds);
            dataGridView1.DataSource = ds.Tables[0];
        }

The application directly connected to the database and pulled them out, but then such a thing as a server appeared between them, the application sends a request to the server, the server pulls data from the database and returns this data to the application. I know how to implement the transfer of a request, but I don’t know how to get an entire table from the database, how can I implement this?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
BasiC2k, 2021-02-11
@BasiC2k

Sending an entire table, especially if it is large, is a sign of an incorrect application architecture.
Data should be sent as the need arises.
The interaction algorithm can be as follows:
1. The application sends (GET or POST) a request to the server;
2. The server processes the incoming request, requests information from the database, converts it, for example, to json, and sends it back;
3. The application receives json, converts it into a class and performs the necessary further actions (displays or processes the received data).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question