ทุกอย่างดึงข้อมูลมาจาก ERP ค่ะ แต่ในช่อง Status จะเปลี่ยนค่าจาก Database
1 = Yes
2 = No
ค่ะ
ไม่ทราบว่าต้องทำอย่างไรคะ
ขอบคุณล่วงหน้ามากค่ะ
นี่คือโค๊ดตอน Bind grid นะคะ
Code (VB.NET)
Sub ea1()
Dim conea As New SqlConnection(ConfigurationManager.ConnectionStrings("LN").ConnectionString)
Dim cmdea As New SqlCommand("Select ttdsls401601.t_item, ttdsls401601.t_corn, ttcibd001601.t_item AS easa, ttdsls401601.t_orno , ttdsls401601.t_pono , ttcibd001601.t_dsca,ttdsls401601.t_qoor , ttccom100601_1.t_nama, twhwmd400601.t_sinv FROM ttccom100601 AS ttccom100601_1 INNER JOIN ttdsls401601 INNER JOIN ttcibd001601 ON ttdsls401601.t_item=ttcibd001601.t_item ON ttccom100601_1.t_bpid = ttdsls401601.t_ofbp INNER JOIN twhwmd400601 ON ttdsls401601.t_item = twhwmd400601.t_item WHERE ttdsls401601.t_orno like '%" & Me.TextBox25.Text & "%' and ttdsls401601.t_pono =" & Me.TextBox23.Text & " and t_sqnb ='0'", conea)
cmdea.CommandType = CommandType.Text
Dim da As New SqlDataAdapter(cmdea)
Dim ds As New DataSet
Dim dr As DataRow
da.Fill(ds, "erp")
Me.GridView2.DataSource = ds.Tables("erp")
Me.GridView2.DataBind()
conea.Close()
Sub ea1()
Dim conea As New SqlConnection(ConfigurationManager.ConnectionStrings("LN").ConnectionString)
Dim cmdea As New SqlCommand("Select ttdsls401601.t_item, ttdsls401601.t_corn, ttcibd001601.t_item AS easa, ttdsls401601.t_orno , ttdsls401601.t_pono , ttcibd001601.t_dsca,ttdsls401601.t_qoor , ttccom100601_1.t_nama, twhwmd400601.t_sinv FROM ttccom100601 AS ttccom100601_1 INNER JOIN ttdsls401601 INNER JOIN ttcibd001601 ON ttdsls401601.t_item=ttcibd001601.t_item ON ttccom100601_1.t_bpid = ttdsls401601.t_ofbp INNER JOIN twhwmd400601 ON ttdsls401601.t_item = twhwmd400601.t_item WHERE ttdsls401601.t_orno like '%" & Me.TextBox25.Text & "%' and ttdsls401601.t_pono =" & Me.TextBox23.Text & " and t_sqnb ='0'", conea)
cmdea.CommandType = CommandType.Text
Dim da As New SqlDataAdapter(cmdea)
Dim ds As New DataSet
Dim dt As New DataTable
dt = ds.Tables("erp")
dt.Columns.Add("StatusDesc", GetType(String))
Dim dr As DataRow
For Each dr In dt.Rows
If dr("Status").ToString() = "1" Then
dr("StatusDesc") = "Yes"
ElseIf dr("Status").ToString() = "0" Then
dr("StatusDesc") = "No"
End If
Next dr
da.Fill(ds, "erp")
Me.GridView2.DataSource = dt
Me.GridView2.DataBind()
conea.Close()