Everything I try to do it just keeps spiting out null. This is the method that gets the data
public List<Item> getItems(string item_name)
{
using (IDbConnection connection = new MySqlConnection(Helper.CnnVal("dbConn")))
{
connection.Open();
return connection.Query<Item>($"SELECT * FROM ITEMS WHERE itm_name = 'Jaje'").ToList();
}
}
NOTE: The query is hardcoded for testing purposes, usually replaced by a stored procedure Even while hardcoded it still returns null.
The item class
public class Item
{
public int _itm_id { get; set; }
public string _itm_name { get; set; }
public float _itm_price { get; set; }
}
I also have the following code in the .xaml.cs file that runs on a button press
List<Item> items = new List<Item>();
items = da.getItems(txtboxItemNameSearch.Text.Trim());
It always returns _itm_id = 0, _itm_name = null, _itm_price = 0. The connection is open, the insert method works fine. The row is not empty. I copied the select hardcoded statement from a query that worked perfectly.
This is the table
CREATE TABLE `items` (
`itm_id` INT(255) NOT NULL AUTO_INCREMENT,
`itm_name` VARCHAR(255) NOT NULL,
`itm_price` FLOAT(8,2) NOT NULL,
PRIMARY KEY (`itm_id`),
UNIQUE INDEX `itm_name` (`itm_name`)
)