Thursday, August 11, 2016

(5/6) C# Printings using Printing Controls In Urdu - Load Data From MS Access Database

6 comments:

  1. Sir when adding resources And i select My access data base then Its show some error "Some file could contain malicious content"... Choose a database Model Dialog And DataBase Objects dialog not appeared

    ReplyDelete
    Replies
    1. Can't help this from here. Search google to find solution.

      Delete
  2. private void Form1_Load(object sender, EventArgs e)
    {
    OleDbConnection conn = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\ACS\Documents\RetailDataBase.accdb");


    conn.Open();

    OleDbCommand objCommand = new OleDbCommand("SELECT Products.[ProductName] FROM Products;", conn);
    //objCommand.CommandText = "Select ProdcutName from Products";
    OleDbDataReader objReader;
    objReader = objCommand.ExecuteReader();

    while (objReader.Read())
    {
    //MessageBox.Show(objReader["ProductName"].ToString());
    itemcomboBox.Items.Add(objReader["ProductName"].ToString());
    }
    objReader.Close();
    conn.Close();
    }

    ReplyDelete
  3. Sir G,Because Of that error I Use This method So is it OK..

    ReplyDelete
  4. oledbexception was unhandled I facing This Problum

    ReplyDelete