I'm trying to retrieve data from SQL server into a gridView Control, but however get 0 values in my first column and an empty column in my second column. My mapping class to get data from sql server:
public class classInvoiceNumberSQL
{
public int RowNumber { get; set; }
public int invoiceNumber { get; set; }
public DateTime InvoiceDate { get; set; }
public string CustomerID { get; set; }
public double InvoiceTotal { get; set; }
}
And this part is where i execute to pull through the data from sql
private void btnLoadByDate_Click(object sender, EventArgs e)
{
using (IDbConnection db = new SqlConnection(ConfigurationManager.ConnectionStrings["Invo_X.P.Properties.Settings.conSQL"].ConnectionString))
{
if (db.State == ConnectionState.Closed)
{
db.Open();
string query = "Select RowLines, invoiceNumber, InvoiceDate, CustomerID, invoiceTotal From tblInvoiceNumber";
classInvoiceNumberSQLBindingSource.DataSource = db.Query<classInvoiceNumberSQL>(query, commandType: CommandType.Text);
}
}
}
Here an overview of whats happening when i run the project. enter image description here
And the data which is in sql server. enter image description here