I am new to c# and Database linking that’s why not able to get this by searching old posts of stackoverflow
Code like
private void bookDetails()
{
string connectionPath = @"Data Source=Data\libraryData.dat;Version=3;New=False;Compress=True";
using (SQLiteConnection connection = new SQLiteConnection(connectionPath))
{
SQLiteCommand command = connection.CreateCommand();
connection.Open();
string query = "SELECT bookno as 'Book No.', bookCode as 'ISBN No.', title as 'Title', author as 'Author', publisher as 'Publishers', edition as 'Edition', storagehint as 'Storage Hint', description as 'Description' FROM booksDetails";
command.CommandText = query;
command.ExecuteNonQuery();
SQLiteDataAdapter da = new SQLiteDataAdapter(command);
DataSet ds = new DataSet();
da.Fill(ds, "booksDetails");
int c = ds.Tables["booksDetails"].Rows.Count;
dataGridView1.DataSource = ds.Tables["booksDetails"];
dataGridView1.Sort(dataGridView1.Columns["ISBN No."], ListSortDirection.Ascending);
dataGridView1.ReadOnly = true;
connection.Close();
this.Totals.Text = "Total No. of Books Found : "+ Convert.ToString(c);
}
}
i used like above for getting some library book details, now i want highlight a particular cell or change its color by the value of no. of book or any other..
sample code preferred
thanks in advance…
and code for event is
this will be auto generated in
yourform.designer.csor else you add it manually