Answer the question
In order to leave comments, you need to log in
How to rework the server code?
Hello!
There is a server and an application, both written in C#, the application sends sql queries to the server, and the server passes these sql queries to the database and they are executed, I managed to implement work with queries that contain INSERT and UPDATE, but it doesn’t work with SELECT.
Here is a piece of server code where an sql query with a SELECT is being processed:
if (message.Contains("SELECT"))
{
string rtrn = null;
SqliteConnection connect = new SqliteConnection("Data source = accounts.db");
connect.Open();
SqliteCommand command = new SqliteCommand(message, connect);
command.ExecuteNonQuery();
SqliteDataReader Reader = command.ExecuteReader();
while (Reader.Read())
{
rtrn = Reader["Password"].ToString();
}
Reader.Close();
byte[] nazad = Encoding.UTF8.GetBytes(rtrn);
stream.Write(nazad, 0, nazad.Length);
}
SqliteDataReader Reader = command.ExecuteReader();
while (Reader.Read())
{
rtrn = Reader["Password"].ToString();
}
Reader.Close();
Answer the question
In order to leave comments, you need to log in
It's just a column name
Reader["Password"]
Well, use Reader[1] // or whatever it is in order, what's the problem?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question