2013-02-01 68 views
0

我想使用ado.net在表單加載上綁定datagridview「無法創建字段Physio_cureTable的子列表」。錯誤iam粘貼在這裏我的代碼請給我建議或幫助如何在ado.net中綁定datagridview

con = new SqlConnection(「Data Source = ADMIN \ SQLEXPRESS; Initial Catalog = PhysioCure; Integrated Security = true」);

 sda = new SqlDataAdapter("select RegisterNo,RegistrationDate,Stimulation,PationName,DateOfBirth,ContactNo,Occupation,Age,Sex,Weight,Chief_Complain,Investigation_Result,PastHistoryAny,Physical_Examination,Ref_By_Doctor,Medications,Prognosis,Electro_Therapy,Neuro_Rehabilitation,Ortho_Rehabilitation,Cardio_Pulmonery_Rehabilitation,Sports_Rehabilitation from Physio_cureTable where Syncoperation <>'D'",con); 
     ds = new DataSet(); 
     sda.Fill(ds); 
     dataGridView1.AutoGenerateColumns = true; 
     dataGridView1.DataSource = ds; 

     dataGridView1.DataMember = "Physio_cureTable".ToString();// error coming this line 
+0

你能否解釋一下你的問題 – user2031802

回答

0
dataGridView1.DataMember = "Physio_cureTable".ToString(); 

Physio_cureTable必須是您與DataGridView的綁定列名

dataGridView1.DataMember = "RegisterNO".ToString();