|  | 
	                
  
    |  |  
    | 
        
        Child list for field 'BusN' cannot be created. ปัญหาเรื่องการแสดงข้อมูล โดยใช้ Databinding , DataView และฐานข้อมูล !     |  
    |  |  
 
	
		|  |  |  |  |  
		|  |  | 
          
            |  Code (C#) 
 using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.OleDb;
namespace TxtSearch
{
    public partial class Search_From : Form
    {
        public Search_From()
        {
            InitializeComponent();
        }
        private void Search_From_Load(object sender, EventArgs e)
        {
            
        }
        private void btnSearch_Click(object sender, EventArgs e)
        {
            string strData = txtSearch.Text;
            string conStr = "Provider=Microsoft.Ace.OleDb.12.0;" + @"Data Source=C:\Users\Plugfai\Documents\Visual Studio 2008\Projects\Project\Bus Transport of Bangkok.accdb";
            OleDbConnection conn = new OleDbConnection(conStr);
            conn.Open();
            string sql = "SELECT * FROM BusLine";
            OleDbCommand cmd = new OleDbCommand(sql, conn);
            OleDbDataAdapter adapter = new OleDbDataAdapter(cmd);
            DataSet data = new DataSet(); 
            adapter.Fill(data, "BusN");
            /*txtshow.Text = data.Tables["BusN"].Rows[0]["Ramble"].ToString(); */
            /*txtshow.DataBindings.Add("Text", data, "BusN.Ramble");*/
            DataView dv = new DataView(data.Tables["BusN"]); 
            dv.RowFilter = "Bus_Number = 'strData'";
            if (strData == "")
            {
                MessageBox.Show("กรุณากรอกเลขสาย หรือสถานที่ค่ะ", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
                txtshow.DataBindings.Add("Text", dv, "BusN.Ramble");
                
                
             conn.Close(); 
        }
      
    }
}
 คือ ผมพิมพ์ ข้อความแล้วเซิส ที่ txtSeach และ แสดงที่ txtShow ด้วยวิธี Databinding
 คราวนี้โค้ด มัน error ในบรรทัด Databinding ซึ่ง ผมเองก็ไม่รู้จะแก้ยังไง
 
 แต่คิดว่าตัวเอง น่าจะเข้าใจถูกแล้ว อ่ะครับ
 เลยมาหา ผู้รู้ช่วยตอบปัญหาให้ผมที !
 
 
 
 Tag : .NET, Ms Access, VBScript, Report Others, Class Library, C#
 
 
 |  
            |  |  
            | 
              
                |  |  |  |  
                |  | 
                    
                      | Date :
                          2011-03-19 19:46:35 | By :
                          plugantz | View :
                          1527 | Reply :
                          5 |  |  |  
                |  |  |  |  |  
            |  |  
		            |  |  
		|  |  |  |  |  
  
    | 
 
        
          |  |  |  |  |  
          |  |  | 
            
              | Error ว่าอะไรครับ ? 
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2011-03-21 09:31:04 | By :
                            webmaster |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
        
          |  |  |  |  |  
          |  |  | 
            
              | Child list for field BusN cannot be created. 
 ไม่เชิง error แต่หยุดค้างที่บรรทัดนี้อะครับ !
 
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2011-03-21 17:06:08 | By :
                            plugantz |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
        
          |  |  |  |  |  
          |  |  | 
            
              | ขอขุด กระทู้หน่อยนะครับ เพราะยังไม่ได้ คำตอบเลย !
 
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2011-03-22 21:40:50 | By :
                            Plugfaii |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
        
          |  |  |  |  |  
          |  |  | 
            
              | Code (VB.NET) 
 adapter.Fill(data);
DataView dv = new DataView(data.Tables[0]);
 
 ลองแบบนี้ดูครับ
 
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2011-03-23 08:28:47 | By :
                            webmaster |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 |  |