private void AcNotextBox_TextChanged(object sender, EventArgs e) { int id; if (!int.TryParse(AcNotextBox.Text, out id)) { return; } string connString = ConfigurationManager.ConnectionStrings["dbx"].ConnectionString; string cmdString = "SELECT * FROM tblBasicInfo WHERE ID =" +Convert.ToString(AcNotextBox.Text); string cmdStringg = "SELECT * FROM tblAccData WHERE ID =" + Convert.ToString(AcNotextBox.Text); using (OleDbConnection conn = new OleDbConnection(connString)) { using (OleDbCommand cmd = new OleDbCommand(cmdString, conn)) { cmd.Parameters.AddWithValue("ID", id); conn.Open(); OleDbDataReader reader = cmd.ExecuteReader(); if (reader.Read()) { NametextBox.Text = (reader["SName"].ToString()); FNametextBox.Text = (reader["FName"].ToString()); AddresstextBox.Text = (reader["Address"].ToString()); CelltextBox.Text = (reader["Cell"].ToString()); NationalitytextBox.Text = (reader["Nationality"].ToString()); ReligiontextBox.Text = (reader["Religion"].ToString()); FCNICNotextBox.Text = (reader["FCNICNo"].ToString()); FatherOccuptextBox.Text = (reader["FOccup"].ToString()); TransportFacilitytextBox.Text = (reader["TranFacility"].ToString()); InFiguredateTimePicker.Text = (reader["DOB"].ToString()); DateofAdmdateTimePicker.Text = (reader["DateofAdm"].ToString()); RegistrationNotextBox.Text = (reader["RegNo"].ToString()); TranFeetextBox.Text = (reader["TransportChr"].ToString()); SRemarkstextBox.Text = (reader["SpecialRemarks"].ToString()); ClassofcomboBox.Text = (reader["ClassofAdm"].ToString()); ClassOfReadcomboBox.Text = (reader["ClassofReading"].ToString()); } }
SELECT CategoryName, ProductName FROM Categories INNER JOIN Products ON Categories.CategoryID = Products.CategoryID;
var conn = new OleDbConnection("Provider=Microsoft.Jet.OleDb.4.0;Data Source=Store.mdb;"); conn.Open(); var dtCustomers = new DataTable(); var adapter = new OleDbDataAdapter("SELECT * FROM Customers;", conn); adapter.Fill(dtCustomers); dataGridView1.DataSource = dtCustomers;
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)