PDA

View Full Version : مبتدی: مشکل در نمایش دیتا گرید ویو



civilmajor
چهارشنبه 26 فروردین 1394, 13:21 عصر
حل شد
دم هرچی آدم باحال و با معرفته گرمحالا به یه مشکل توی دیتاگرید خوردم،
میخوام فیلدایی که از جداولم باهم مرتبتا تحت یه جدول توی دیتاگرید بهم نشون بده اما پیغامی که توی عکسه بهم نشون میده.
http://barnamenevis.org/attachment.php?attachmentid=130352&d=1429087643
این کدمه:


void FillDataGrid()
{
OleDbConnection conn = new OleDbConnection("Provider=Microsoft.Ace.OLEDB.12.0 ;Data Source=" + Application.StartupPath + "\\GymDataBase.accdb");
DataSet ds = new DataSet();
OleDbDataAdapter da = new OleDbDataAdapter();
da.SelectCommand = new OleDbCommand();
da.SelectCommand.CommandType = CommandType.Text;
da.SelectCommand.CommandText = "SELECT CodMelli,RegDate,Pic,Nam,Family,Father,[Gender],BirthCity,BirthDate,GymName,AgeTypeStudent,Weight Student,[Tell],[Mobile],[Address],[E-Mail],NameOfCollegeOrSchool,StudingLevel,[Level],AverageScore,RecentlyMounth,DateOfPay,[Money],PayID,PayAll,OntimeOrNot,HozorDate,VaziyatHozor,B eltBelt,DateOfBelt,BeltPlace,BeltCertificateNum,Da teOfMatch,MatchPlace,AgeTypeHero,WeightHero,BeltHe ro,DegreeHero,MatchCertificateNum,[Province],DegreeInProvince,[Contry],DegreeInContry,BeltAccept,HomeWorkForm,StudCoapor ation,ParentCoaporation,SchoolVerification,ParentV erification,ParentPresentation,LeisureCamp,ProCamp ,MasterScore,OtherSuccesses,[Cup] FROM PresentOrAbsent INNER JOIN (Others INNER JOIN (Knowledge INNER JOIN (Hero INNER JOIN (Tuition INNER JOIN (Belt INNER JOIN Student ON Belt.ID = Student.CodMelli) ON Tuition.ID = Student.CodMelli) ON Hero.ID = Student.CodMelli) ON Knowledge.ID = Student.CodMelli) ON Others.ID = Student.CodMelli) ON PresentOrAbsent.ID = Student.CodMelli";



try
{
conn.Open();
da.SelectCommand.Connection = conn;
da.SelectCommand.ExecuteNonQuery();

da.Fill(ds, "Table");
dataGridView2.DataSource = ds;
dataGridView2.DataMember = "Table";


conn.Close();
}
catch (Exception e1)
{
MessageBox.Show(e1.Message);
}
}