|  | 
	                
  
    |  |  
    | 
        
        ช่วยเขียนโค้ดค้นหาสมาชิกให้ด้วยครับ ใช้ VisualBasic2008 ครับ ใกล้จะส่งแล้ว     |  
    |  |  
 
	
		|  |  |  |  |  
		|  |  | 
          
            | รบกวนพี่ๆช่วยเขียนโค้ดค้นหาข้อมูลสมาชิกให้ด้วยครับ คือค้นหาสมาชิกจาก id แล้วถ้าหากข้อมูลตรงก็ให้ข้อมูลที่มีอยู่ในฐานข้อมูลมาแสดงในเท็กบ็อก ที่กำหนดไว้
 แล้วถ้าหากไม่พบก็ข้อมูลก็ให้แจ้งด้วยอะครับ
 ขอบคุณล่วงหน้านะครับ
 
 ตารางฐานข้อมูล
 
 tb_profile
 [p_id],[p_name],[p_email],[p_address],[p_province],[p_tel]
 
 แบบฟอร์ม
 
  
 
 
 Tag : .NET, Ms SQL Server 2008, Win (Windows App), VB.NET, VS 2008 (.NET 3.x), Windows
 
 
 |  
            |  |  
            | 
              
                |  |  |  |  
                |  | 
                    
                      | Date :
                          2013-01-25 11:00:57 | By :
                          teera007 | View :
                          995 | Reply :
                          2 |  |  |  
                |  |  |  |  |  
            |  |  
		            |  |  
		|  |  |  |  |  
  
    | 
 
        
          |  |  |  |  |  
          |  |  | 
            
              | Code (VB.NET) 
 btnsearch event click
conn.open
strsql = select [p_id],[p_name],[p_email],[p_address],[p_province],[p_tel] from tb_profile where [p_id] = txtsearch
dim dr as sqldataReader
dim cmd as sqlcommand
cmd = New SqlCommand(strsql, Conn)
dr = cmd.ExecuteReader()
if dr.read then
txtname.text = dr.getvalue(1).tostring
txtemil.text =dr.getvalue(2).tostring
txtaddress.text =dr.getvalue(3).tostring
txtprovince.text=dr.getvalue(4).tostring
txttel.text=dr.getvalue(5).tostring
else
MsgBox("ไม่พบข้อมูล",16,"ไม่พบข้อมูล")
end if
conn.close
 น่าจะประมานนี้
 
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2013-01-25 15:08:58 | By :
                            nano |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
        
          |  |  |  |  |  
          |  |  | 
            
              | ขอบคุณครับ เดี๋ยวเอากลับไปลองดูครับ 
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2013-01-25 16:09:32 | By :
                            teera007 |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  |  |