Hi,
I had suggest working with C# MySQL.Data libraries using format:
Call SUGGEST ('somevalue', 'my_index');
However, after migrating to HttpClient libraries, it no longer is working. Any guidance or referral to some documentation would be greatly appreciated.
Sergey
October 11, 2024, 5:04pm
2
Pls provide more details on what library you are using and the error.
Error message is: “only SELECT queries are supported”
C# library: System.Net.Http
Sample Code:
var suggest = $"CALL SUGGEST('apprl','my_index')";
System.Net.Http HttpClient _httpClient = new HttpClient();
var encodedQuery = new StringContent("query=" + suggest,
Encoding.UTF8, "application/x-www-form-urlencoded");
try
{
System.Net.Http.HttpResponseMessage response =
_httpClient.PostAsync("https://srv10v/sql", encodedQuery).Result;
string responsBody = response.Content.ReadAsStringAsync().Result;
var jsonResults = JsonConvert.DeserializeObject<SuggestResponse>(responsBody);
}
catch
{
}
Sergey
October 12, 2024, 3:41pm
4
1 Like
Perfect, thank you so much, that resolved my problem