Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,030

HOME > .NET Framework > Forum > (.NET) join table problem Help me please.. SQL , WHERE , INNER JOIN



 

(.NET) join table problem Help me please.. SQL , WHERE , INNER JOIN

 



Topic : 044807



โพสกระทู้ ( 3 )
บทความ ( 0 )



สถานะออฟไลน์




Code (VB.NET)
<%@ Import Namespace="system.data.sqlclient" %>

<script language="vbscript" runat="server">
    Sub page_load()
        If Not IsPostBack Then
            Dim mycon As SqlConnection
            Dim mycmd As SqlCommand
            Dim myrd As SqlDataReader
            Dim tmpsql As String
            mycon = New SqlConnection("data source=.;Initial Catalog=hotel;Integrated Security=true")
            mycon.Open()
          
            tmpsql = "select DepartmentName from Department "
            mycmd = New SqlCommand(tmpsql, mycon)
            myrd = mycmd.ExecuteReader()
        
            DropDownList1.DataSource = myrd
            DropDownList1.DataTextField = "DepartmentName"
            DropDownList1.DataBind()
            DropDownList1.Items.Insert(0, New ListItem("select DepartmentName", -1))
            myrd.Close()
            mycon.Close()
        End If
     
    End Sub
    Sub bindproducts(ByVal intcatid As Integer)
        Dim myconn As SqlConnection
        Dim mycommand As SqlCommand
        Dim myreader As SqlDataReader
        Dim tmpsql As String
        myconn = New SqlConnection("data source=.;initial catalog=hotel;integrated security=true")
        myconn.Open()
        tmpsql = "SELECT Department.DepartmentName AS Expr1, Employee.fullName AS Expr2, Employee.Gender AS Expr3, Employee.Age AS Expr4, Employee.BOD AS Expr5,   Employee.phoneNumber AS Expr6, Address.Village AS Expr7, Address.City AS Expr8, Address.province AS Expr9, Income.[Position] AS Expr10, Income.salary AS Expr11, Income.serviceTag AS Expr12, [employee start].HireDate AS Expr13, [employee start].StaffDate AS Expr14 FROM Department INNER JOIN Employee ON Department.DepartmentID = Employee.DepartmentID INNER JOIN Address ON Employee.employeeID = Address.employeeID INNER JOIN Income ON Employee.employeeID = Income.employeeID INNER JOIN [employee start] ON Employee.employeeID = [employee start].employeeID where DepartmentID=@catid"
        mycommand = New SqlCommand(tmpsql, myconn)
        mycommand.Parameters.AddWithValue("@catid", intcatid)
        myreader = mycommand.ExecuteReader()
        Repeater1.DataSource = myreader
        Repeater1.DataBind()
        
        myreader.Close()
        myconn.Close()
            
    End Sub
    
    Sub dropdownlist1_changed(ByVal s As Object, ByVal e As EventArgs)
        Dim intcatid As Integer
        intcatid = DropDownList1.SelectedIndex.ToString
        If intcatid <> -1 Then
            bindproducts(intcatid)
        End If
    End Sub
    
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Untitled Page</title>
</head>
<body bgcolor="#6600cc">
    <form id="form1" runat="server">
        <div style="text-align: center">
            <span style="font-size: 32pt"><span style="color: #cc0000">Management Hotel System</span><br />
                <br />
                <span style="font-size: 16pt; color: #ffcc33">Select Department
                    <br />
                    <br />
                    <asp:dropdownlist style="left: 311px; top: 142px;" id="DropDownList1" autopostback="true"
                        onselectedindexchanged="DropDownList1_changed" runat="server" height="32px" width="197px">
                </asp:dropdownlist>
                    <asp:button style="left: 362px; top: 199px;" id="Button1" runat="server" text="View"
                        width="87px" height="21px" />
                    <table border="1" width="" style="background-color: yellow">
                        <?xml namespace="" prefix="ASP" ?>
                        <?xml namespace="" prefix="ASP" ?>
                        <asp:repeater id="Repeater1" enableviewstate="false" runat="server">

        <ItemTemplate> 
        <tr>
        <td width="300"> <%#Container.DataItem("fullName")%></td>
 
        <td width="200" align ="right" ><%#Container.DataItem("BOD")%>  </td>
         <td width="" align ="center" ><%#Container.DataItem("Gender")%>  </td>
        <td width="100" align ="right" ><%#Container.DataItem("PhoneNumber")%>  </td>
         <td width="100" align ="right" ><%#Container.DataItem("Village")%>  </td>
          <td width="100" align ="right" ><%#Container.DataItem("City")%>  </td>
        </tr>
        
       
      
        </ItemTemplate></asp:repeater>
                        <td style="width: 300px">
                        </td>
                        <td align="right" width="200">
                        </td>
                        <td style="width: 300px">
                        </td>
                    </table>
                    <br />
                </span></span>
        </div>
    </form>
</body>
</html>




Tag : - - - -







Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2010-07-01 15:58:42 By : boot View : 2499 Reply : 3
 

 

No. 1



โพสกระทู้ ( 74,058 )
บทความ ( 838 )

สมาชิกที่ใส่เสื้อไทยครีเอท

สถานะออฟไลน์
Twitter Facebook

แล้วมันติดตรงไหนครับ






Date : 2010-07-01 23:22:35 By : webmaster
 


 

No. 2



โพสกระทู้ ( 3 )
บทความ ( 0 )



สถานะออฟไลน์


I can not retrive data from table
Date : 2010-07-03 09:16:48 By : boot
 

 

No. 3



โพสกระทู้ ( 72 )
บทความ ( 0 )



สถานะออฟไลน์


Can you show me error message?
If I see error message maybe I understand your problem more.
Date : 2010-07-06 11:49:28 By : whiteshark
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : (.NET) join table problem Help me please.. SQL , WHERE , INNER JOIN
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ FTP| ใส่แถวของตาราง ใส่คอลัมน์ตาราง| ตัวยก ตัวห้อย ตัวพิมพ์ดีด| ใส่โค้ด ใส่การอ้างถึงคำพูด| ใส่ลีสต์
smiley for :lol: smiley for :ken: smiley for :D smiley for :) smiley for ;) smiley for :eek: smiley for :geek: smiley for :roll: smiley for :erm: smiley for :cool: smiley for :blank: smiley for :idea: smiley for :ehh: smiley for :aargh: smiley for :evil:
Insert PHP Code
Insert ASP Code
Insert VB.NET Code Insert C#.NET Code Insert JavaScript Code Insert C#.NET Code
Insert Java Code
Insert Android Code
Insert Objective-C Code
Insert XML Code
Insert SQL Code
Insert Code
เพื่อความเรียบร้อยของข้อความ ควรจัดรูปแบบให้พอดีกับขนาดของหน้าจอ เพื่อง่ายต่อการอ่านและสบายตา และตรวจสอบภาษาไทยให้ถูกต้อง

อัพโหลดแทรกรูปภาพ

Notice

เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ
อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง

   
  เพื่อความปลอดภัยและการตรวจสอบ กระทู้ที่แทรกไฟล์อัพโหลดไฟล์จากที่อื่น อาจจะถูกลบทิ้ง
 
โดย
อีเมล์
บวกค่าให้ถูก
<= ตัวเลขฮินดูอารบิก เช่น 123 (หรือล็อกอินเข้าระบบสมาชิกเพื่อไม่ต้องกรอก)







Exchange: นำเข้าสินค้าจากจีน, Taobao, เฟอร์นิเจอร์, ของพรีเมี่ยม, ร่ม, ปากกา, power bank, แฟลชไดร์ฟ, กระบอกน้ำ

Load balance : Server 03
ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2024 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่