मेरे पास एक डेटाग्रिड व्यू है जिसे मैंने WinForms प्रोजेक्ट में सेटअप किया है। कॉलम सभी डिजाइनर फ़ाइल में परिभाषित हैं। जब मैं अपने SQL को चलाने के लिए जाता हूं तो DataGridView में कॉलम क्वेरी में कॉलम नामों के साथ प्रतिस्थापित हो जाते हैं।प्री-डिफ़ाइंड कॉलम के साथ डेटाग्रिड व्यू के डेटासेट
मैं डेटाग्रिड व्यू द्वारा परिभाषित कॉलम को कैसे रखूं, और डेटासेट से डेटासेट से पंक्तियों को ग्रिड व्यू में जोड़ें।
//Columns as they appear in the DataGridView
Name | Address | City | State | Zip | Account Num |
//Populate the gridView
DataSet ds = Account.search(strSearch);
accountGrid.DataSource = ds.Tables[0];
//query
string sql = "SELECT distinct acctNum, name, address, city, state, zip from accounts";
return DataService.GetDataSet(sql);
//The End Result of the columns
acctNum | name | address |city | state | zip