rowlandsfc
Active member
i have trying to read a database and display it into a datagridview but i keep getting the error
C#:
private void nameSearch()
{
using (SQLiteCommand cmd = connAccount.CreateCommand())
{
connAccount.Open();
try
{
connAccount = new SQLiteConnection(dbConnection.source);
cmd.CommandText = @"SELECT accid, account.custid, customer.title, customer.firstname || ' ' || customer.lastname AS Name, product.isaname AS ProductName, balance, accrued, active FROM account INNER JOIN customer ON customer.custid = account.custid INNER JOIN product ON product.prodid = account.prodid WHERE Name = @setName";
cmd.Parameters.AddWithValue("@setName", txt_name.Text);
cmd.ExecuteNonQuery();
da_Accounts = new SQLiteDataAdapter(cmd.CommandText, connAccount);
dt_Accounts = new DataTable();
da_Accounts.Fill(dt_Accounts);
dgv_Account.DataSource = dt_Accounts;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
}
Last edited by a moderator: