Этот баннер — требование Роскомнадзора для исполнения 152 ФЗ.
«На сайте осуществляется обработка файлов cookie, необходимых для работы сайта, а также для анализа использования сайта и улучшения предоставляемых сервисов с использованием метрической программы Яндекс.Метрика. Продолжая использовать сайт, вы даёте согласие с использованием данных технологий».
Политика конфиденциальности

Новые сообщения [новые:0]
Дайджест
Горячие темы
Избранное [новые:0]
Форумы
Пользователи
Статистика
Статистика нагрузки
Мод. лог
Поиск
|
|
29.07.2004, 17:43
|
|||
|---|---|---|---|
|
|||
Отображение данных в dataGrid из SQLCE |
|||
|
#18+
В SQLCE устанвливаю свойство DataGrid1.DataSource=DataSet1; dataGrid остается пустой, хотя при таком выводе все записи показываются foreach(DataRow dr in dt.Rows) { MessageBox.Show(string.Format("{0} {1} {2}", dr["id"],dr["Vol"],dr["idmeter"])); } Что надо сделать для того чтобы dataGrid отображал данные dataSet из SQLCE? -=<TaReN>=- ... |
|||
|
:
Нравится:
Не нравится:
|
|||
|
|
|
29.07.2004, 17:48
|
|||
|---|---|---|---|
Отображение данных в dataGrid из SQLCE |
|||
|
#18+
А Fill(DataSet1) в _Load использовали? ... |
|||
|
:
Нравится:
Не нравится:
|
|||
|
|
|
29.07.2004, 18:40
|
|||
|---|---|---|---|
|
|||
Отображение данных в dataGrid из SQLCE |
|||
|
#18+
можно еще и вот так using System; using System.Drawing; using System.Collections; using System.Windows.Forms; using System.Data; using System.Data.SqlServerCe; using System.Data.Common; namespace DataGrid { /// <summary> /// Summary description for Form1. /// </summary> public class Form1 : System.Windows.Forms.Form { private System.Windows.Forms.DataGrid dataGrid1; //Declare the connection, DataAdapter, and DataSet. private System.Data.SqlServerCe.SqlCeConnection sqlConn; private System.Data.SqlServerCe.SqlCeDataAdapter sqlDA; private System.Data.DataSet sqlDS; public Form1() { // // Required for Windows Form Designer support. // InitializeComponent(); // // TODO: Add any constructor code after InitializeComponent call // try { sqlDS = new DataSet(); //It is assumed that there is a Sql Server CE database //named test.sdf, and that the database has a table named //People. These should be modified to fit your needs. sqlConn = new SqlCeConnection("Data Source=test.sdf"); //Select everything from the People table. sqlDA = new SqlCeDataAdapter("SELECT * FROM People", sqlConn); //Fill the DataTable People within the DataSet. sqlDA.Fill(sqlDS, "People"); //Set the DataSource to the People table in the DataSet. dataGrid1.DataSource = sqlDS.Tables["People"]; } catch (SqlCeException err) { //Add error handling code here. } } /// <summary> /// Clean up any resources being used. /// </summary> protected override void Dispose( bool disposing ) { base.Dispose( disposing ); } #region Windows Form Designer generated code /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.dataGrid1 = new System.Windows.Forms.DataGrid(); // // dataGrid1 // this.dataGrid1.Location = new System.Drawing.Point(0, 16); this.dataGrid1.Size = new System.Drawing.Size(240, 256); this.dataGrid1.Text = "dataGrid1"; // // Form1 // this.Controls.Add(this.dataGrid1); this.MinimizeBox = false; this.Text = "DataGrid"; } #endregion /// <summary> /// The main entry point for the application. /// </summary> static void Main() { Application.Run(new Form1()); } } } ... |
|||
|
:
Нравится:
Не нравится:
|
|||
|
|
|
30.07.2004, 08:44
|
|||
|---|---|---|---|
|
|||
Отображение данных в dataGrid из SQLCE |
|||
|
#18+
Да вместо "DataGrid1.DataSource=DataSet1;" написал с указанием конкретной таблицы "dataGrid1.DataSource = DataSet1.Tables["vol"];" и все заработало, а я думал что он из строки запроса поймет сам какую таблицу выводить -=<TaReN>=- ... |
|||
|
:
Нравится:
Не нравится:
|
|||
|
|
|

start [/forum/topic.php?fid=20&mobile=1&tid=1438692]: |
0ms |
get settings: |
8ms |
get forum list: |
16ms |
check forum access: |
3ms |
check topic access: |
3ms |
track hit: |
45ms |
get topic data: |
10ms |
get forum data: |
3ms |
get page messages: |
40ms |
get tp. blocked users: |
1ms |
| others: | 253ms |
| total: | 382ms |

| 0 / 0 |
