Answer the question
In order to leave comments, you need to log in
MySQL C# Windows Forms how to do?
Please help, I made a SELECT query to the table and the name of the element in the table, now I need to extract the value of the "urlimage" element from there and put it in the string variable.
string newstitle = "";
string newsdesc = "";
string newsurl = "";
string newsimageloc = "";
/*MySqlCommand command = new MySqlCommand("SELECT `title` FROM `launchernews` WHERE `id` = 1", db.GetConnection());
object result = command.ExecuteScalar();
newstitle = Convert.ToString(result);
MySqlCommand command1 = new MySqlCommand("SELECT `description` FROM `launchernews` WHERE `id` = 1", db.GetConnection());
object result1 = command1.ExecuteScalar();
newsdesc = Convert.ToString(result1);
MySqlCommand command2 = new MySqlCommand("SELECT `url` FROM `launchernews` WHERE `id` = 1", db.GetConnection());
object result2 = command.ExecuteScalar();
newsurl = Convert.ToString(result2);*/
MySqlCommand command3 = new MySqlCommand("SELECT `urlimage` FROM `launchernews` WHERE `id` = 1", db.GetConnection());
//adapter.SelectCommand = command;
//adapter.SelectCommand = command1;
//adapter.SelectCommand = command2;
adapter.SelectCommand = command3; // еррор адаптера тут, из-за того, что значение - нуль.
//adapter.Fill(newstable);
Answer the question
In order to leave comments, you need to log in
https://docs.microsoft.com/en-us/dotnet/framework/...
But I was moved to something higher level.
- Dapper, for SQL lovers
- EF Core, for LINQ lovers and change tracker.
- linq2db, for fans of LINQ and non-fans of the change tracker
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question