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,027

HOME > .NET Framework > Forum > อยากทราบว่าดึงข้อมูลในฐานข้อมูลมาโชว์TextBoxจะได้ไหมครับ



 

อยากทราบว่าดึงข้อมูลในฐานข้อมูลมาโชว์TextBoxจะได้ไหมครับ

 



Topic : 124776



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



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




คือโปรเจ็คขอผมเหมือกับโปรแกรมระบบงานคลังสินค้าครับ
ผมอยากค้นหารหัสสินค้าแล้วให้มันโชว์ในTextbox แล้วค่อย แอดลง GridView เสร็จแล้วให้เก็บค่าใน GridView ลงฐานข้อมูลจะได้มั๊ยครับ
Code (ASP)
<table Align="Center">
    <caption><h1>ระบบรับเข้าสินค้า</h1></caption>
<tr>
    <th><h3>รหัสสินค้า :</h3></th>
    <th><asp:TextBox ID ="textID" 
        runat="server" 
        Height="30px" 
        Width="231px">
        </asp:TextBox></th>
    <th><h3>รายการสินค้า:</h3></th>
    <th><asp:TextBox ID ="TextName" 
        runat="server" 
        Height="30px" 
        Width="231px">
        </asp:TextBox>
        <th><h3>รายละเอียดสินค้า :</h3></th>
        <th><asp:TextBox ID ="TextDetail" 
        runat="server" 
        Height="30px" 
        Width="231px">
        </asp:TextBox></th>
        </th>
</tr>
        <tr>
        <th><h3>ปริมาณสินค้า :</h3></th>
        <th><asp:TextBox ID ="TextUnit" 
            runat="server" 
            Height="30px" 
            Width="231px">
            </asp:TextBox></th>
        <th><h3>ราคาสินค้า :</h3></th>
        <th><asp:TextBox ID ="TextPrice" 
            runat="server" 
            Height="30px" 
            Width="231px">
            </asp:TextBox></th>
        <th><h3>จำนวนคงเหลือ :</h3></th>
        <th><asp:TextBox ID ="TextQuantity" 
            runat="server" 
            Height="30px" 
            Width="231px">
            </asp:TextBox></th>
        </tr>
            <tr>
            <th><h3>เลขที่ใบสั่งซื้อ :</h3></th>
            <th><asp:TextBox ID ="TextInvoice" 
                runat="server" 
                Height="30px" 
                Width="231px">
                </asp:TextBox></th>
            <th><h3>วันที่ :</h3></th>
            <th><asp:TextBox ID ="TextDate" 
                runat="server" 
                Height="30px" 
                Width="231px">
                </asp:TextBox>
                </th>
                <th><h3>จำนวนสินค้ารับเข้า :</h3></th>
                <th><asp:TextBox ID ="TextIN" 
                runat="server" 
                Height="30px" 
                Width="231px">
                </asp:TextBox></th>
            </tr>
</table>
</br>
<table Align="Center">
<tr>
                        <th><asp:Button ID="cmdSearch" runat="server" Text="ค้นหาสินค้า" Width="98px" /></th>
                        <th><asp:Button ID="cmdAdd" runat="server" Text="รับเข้า" Width="98px" /></th>
                        <th><asp:Button ID="cmdSave" runat="server" Text="บันทึก" Width="98px" /></th>
                        <th><asp:Button ID="Button2" runat="server" Text="ล้างข้อมูล" Width="98px" /></th>
                    </tr>
</table>
<br />
</br>
<asp:GridView ID="gvSear" 
            runat="server" 
            AutoGenerateColumns="False"
            CellPadding="5" 
            Gridlines="None" 
            ForeColor="#333333"
            ALign="Center">
            <AlternatingRowStyle BackColor="White" />
            <Columns>
                <asp:BoundField DataField="TextInvoice" 
                    HeaderText="เลขที่ใบสั่งซื้อ"
                    ReadOnly="True" 
                    SortExpression="Invoice_ID" />
                <asp:BoundField DataField="Date_IN" 
                    HeaderText="วันที่สั่งซื้อ"
                    ReadOnly="True" 
                    SortExpression="TextDate" />
                <asp:BoundField DataField="Product_ID" 
                    HeaderText="รหัสสินค้า" 
                    ReadOnly="True" 
                    SortExpression="TextID" />
                <asp:BoundField DataField="Product_Quantity" 
                    HeaderText="จำนวนรับเข้า" 
                    ReadOnly="True" 
                    SortExpression="TextQuantity" />
                <asp:BoundField DataField="Product_Price" 
                    HeaderText="ราคาสินค้า" 
                    ReadOnly="True" 
                    SortExpression="TextPrice" />
                <asp:BoundField DataField="Product_Amount" 
                    HeaderText="รวมราคาสินค้า" 
                    ReadOnly="True" 
                    SortExpression="TextAmount" />
            </Columns>
            <EditRowStyle BackColor="#7C6F57" />
            <FooterStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
            <HeaderStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="#666666" ForeColor="White" HorizontalAlign="Center" />
            <RowStyle BackColor="#E3EAEB" />
            <SelectedRowStyle BackColor="#C5BBAF" Font-Bold="True" ForeColor="#333333" />
            <SortedAscendingCellStyle BackColor="#F8FAFA" />
            <SortedAscendingHeaderStyle BackColor="#246B61" />
            <SortedDescendingCellStyle BackColor="#D4DFE1" />
            <SortedDescendingHeaderStyle BackColor="#15524A" />
        </asp:GridView>   

Code (VB.NET)
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim _q = Request.QueryString("q")
        If (_q IsNot Nothing) Then
            If _q.Trim() <> "" Then
                Dim db As New dbIndirectDataContext()
                Dim ts = From t In db.Products
                         Where t.Product_ID.Contains(_q)
                         Order By t.Product_ID Descending
                         Select New With {
                 .Product_ID = t.Product_ID,
                 .Product_Name = t.Product_Name,
                 .Product_Detail = t.Product_Detail,
                 .Product_Unit = t.Product_Unit,
                 .Product_Price = t.Product_Price,
                 .Product_Quantity = t.Product_Quantity
                }
                If ts.Rows.Count > 0 Then
                    TextName.Text = ts.Rows(0)("Product_Name")
                End If
            Else
                Response.RedirectPermanent("StockIN.aspx")
            End If
        End If
    End Sub

    Protected Sub cmdSearch_Click(sender As Object, e As System.EventArgs) Handles cmdSearch.Click
        If textID.Text.Trim() <> "" Then
            Response.RedirectPermanent("StockIN.aspx?q=" & textID.Text.Trim())
        End If




Tag : ASP, Web (ASP.NET)









ประวัติการแก้ไข
2016-09-28 20:04:46
2016-09-29 16:28:19
2016-10-04 14:43:23
Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2016-09-28 16:19:41 By : phumiphach View : 906 Reply : 1
 

 

No. 1



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



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


ลองเปลี่ยนแบบนี้ก็ยังไม่โชว์ ดันครับ
Code (VB.NET)
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim _q = Request.QueryString("q")
        If (_q IsNot Nothing) Then
            If _q.Trim() <> "" Then
                Dim db As New dbIndirectDataContext()
                Dim ts = From t In db.Products
                         Where t.Product_ID.Contains(_q)
                         Order By t.Product_ID Descending
                         Select New With {
                 .Product_ID = t.Product_ID,
                 .Product_Name = t.Product_Name,
                 .Product_Detail = t.Product_Detail,
                 .Product_Unit = t.Product_Unit,
                 .Product_Price = t.Product_Price,
                 .Product_Quantity = t.Product_Quantity
                }
                If ts.Count() > 0 Then
                    Dim a As New
                    TextName.Text = a.GetType()
                    TextDetail.Text = a.GetType()
                    TextUnit.Text = a.GetType()
                    TextPrice.Text = ts.GetType()
                    TextQuantity.Text = ts.GetType()
                End If
            Else
                Response.RedirectPermanent("StockIN.aspx")
            End If
        End If







แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2016-09-29 14:50:27 By : phumiphach
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : อยากทราบว่าดึงข้อมูลในฐานข้อมูลมาโชว์TextBoxจะได้ไหมครับ
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ 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 02
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 อัตราราคา คลิกที่นี่