الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

combobox with access db

مغلق
بدأه Shallan في 18 يوليو 2007 · 3 رد · 1,025 مشاهدة · في ADO.NET
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

i have one combobox in my c# app, and one combobox in my access database, i want to populate the combobox list in the access database to be shown in the app combobox.

any ideas

thanks

#2

مننساش

using System.Data.OleDb;

  OleDbConnection sc=new OleDbConnection("Data Source=C:\\db1.mdb;Provider=Microsoft.Jet.OLEDB.4.0;");
  OleDbCommand com=new OleDbCommand();
  OleDbDataReader sdr;
  com.Connection = sc;
  com.CommandText = "select * from logn ";
  sc.Open();
  try
  {
	 sdr = com.ExecuteReader();	  

	 while (sdr.Read())
	  {
	comboBox1.Items.Add(sdr["pass"].ToString().Trim());			
	  }
	 sc.Close();
   }
   catch (Exception) { }
#3
برو كتب:
مننساش

using System.Data.OleDb;

  OleDbConnection sc=new OleDbConnection("Data Source=C:\\db1.mdb;Provider=Microsoft.Jet.OLEDB.4.0;");
  OleDbCommand com=new OleDbCommand();
  OleDbDataReader sdr;
  com.Connection = sc;
  com.CommandText = "select * from logn ";
  sc.Open();
  try
  {
	 sdr = com.ExecuteReader();	  

	 while (sdr.Read())
	  {
	comboBox1.Items.Add(sdr["pass"].ToString().Trim());			
	  }
	 sc.Close();
   }
   catch (Exception) { }

I have taken your code i replaced the data soirce to my actual data source (the mdb file path), logn with my table name, pass with my column name.

but still nothing appeared in the combobox

apreciate your response

#4

أخي أكتب باللغة العربية كي تحصل على الإجابة

هذا الموضوع مغلق.

مواضيع مشابهة