|
![](/images/resource/spacer.gif) |
|
Android ต้องการให้ดึงข้อมูลจากดาต้าเบสมาแสดง แต่ค่าที่ดึงมามันมาไม่ครบต้องทำยังไงคะ |
|
![](/images/resource/viewboard_01.gif?v=1001) |
|
|
![](/images/resource/viewboard_03.gif?v=1001) |
![](/images/resource/viewboard_04.gif?v=1001) |
|
จริงๆต้องแสดงข้อมูลเป็น 2 รายการ แต่มันแสดงแค่รายการเดียว ใจจริงอยากทำเป็น Listview ด้วยคะ ช่วยด้วยนะคะ ขอบคุณคะ
ส่วนของโค๊ด
try {
Connection con = connectionClass.CONN();
String query = "select dbo.CustomerShipToAddress.ContactPerson as CustomerName ,dbo.DeliveryAddress.MainTrxNo as MainTrxNo, dbo.DeliveryAddress.ShipToID as ShipToID, dbo.DeliveryAddress.CustomerID as CustomerID, dbo.DeliveryAddress.OrderID as OrderID , dbo.DeliveryHead.DeliveryNo as DeliveryNo, dbo.DeliveryHead.BranchCode as BranchCode from dbo.DeliveryHead,dbo.DeliveryAddress,dbo.CustomerShipToAddress where dbo.DeliveryHead.MessengerID='" + StaffID + "' and dbo.DeliveryHead.DeliveryNo=dbo.DeliveryAddress.DeliveryNo and dbo.DeliveryHead.BranchCode=dbo.DeliveryAddress.BranchCode and dbo.DeliveryAddress.ShipToID=dbo.CustomerShipToAddress.ShipToID and dbo.DeliveryAddress.CustomerID=dbo.CustomerShipToAddress.CustomerID ";
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery( query );
if (rs.next()) {
DeliveryNo = rs.getString( "DeliveryNo" );
BranchCode = rs.getString( "BranchCode" );
OrderID = rs.getString( "OrderID" );
MainTrxNo = rs.getString( "MainTrxNo" );
ShipToID = rs.getString( "ShipToID" );
CustomerID = rs.getString( "CustomerID" );
CustomerName = rs.getString( "CustomerName" );
textView2.setText("DeliveryNo : " + DeliveryNo + " \n" + "BranchCode : " + BranchCode + " \n" + "OrderID : " + OrderID + " \n" + "CustomerID : " + CustomerID + " \n" + "MainTrxNo : " + MainTrxNo + " \n" + "CustomerName : " + CustomerName );
}
} catch (SQLException e) {
e.printStackTrace();
}
หน้าผลลัพธ์
![ภ ภ](https://www.thaicreate.com/upload/stock/20160921132520.png?v=1001)
ดาต้าเบส
![2 2](https://www.thaicreate.com/upload/stock/20160921132239.png?v=1001)
Tag : Mobile, Ms SQL Server 2005, Ms SQL Server 2008, Ms SQL Server 2012, Android, Mobile
![](/images/adv.jpg?v=1001)
|
ประวัติการแก้ไข 2016-09-21 13:25:44
|
![](/images/resource/blockviewtopic_01.gif?v=1001) |
![](/images/resource/blockviewtopic_02.gif?v=1001) |
![](/images/resource/blockviewtopic_03.gif?v=1001) |
![](/images/resource/blockviewtopic_04.gif?v=1001) |
Date :
2016-09-21 13:25:09 |
By :
aummyasia |
View :
1224 |
Reply :
4 |
|
![](/images/resource/blockviewtopic_06.gif?v=1001) |
![](/images/resource/blockviewtopic_07.gif?v=1001) |
![](/images/resource/blockviewtopic_08.gif?v=1001) |
![](/images/resource/blockviewtopic_09.gif?v=1001) |
|
|
|
![](/images/resource/viewboard_06.gif?v=1001) |
![](/images/resource/viewboard_07.gif?v=1001) |
|
![](/images/resource/viewboard_08.jpg?v=1001) |
![](/images/resource/viewboard_09.gif?v=1001) |
![](/images/resource/viewboard_01.gif?v=1001) |
|
|
![](/images/resource/viewboard_03.gif?v=1001) |
![](/images/resource/viewboard_04.gif?v=1001) |
|
ดูแล้วน่าจะผิดที่ JOIN ครับ ส่วนจะผิดตรงไหน จะต้องลองงนั่งไล่ดูครับ ![](/images/bbcode/grin.gif?v=1001)
|
![](/images/resource/blockviewtopic_01.gif?v=1001) |
![](/images/resource/blockviewtopic_02.gif?v=1001) |
![](/images/resource/blockviewtopic_03.gif?v=1001) |
![](/images/resource/blockviewtopic_04.gif?v=1001) |
Date :
2016-09-21 22:24:09 |
By :
mr.win |
|
![](/images/resource/blockviewtopic_06.gif?v=1001) |
![](/images/resource/blockviewtopic_07.gif?v=1001) |
![](/images/resource/blockviewtopic_08.gif?v=1001) |
![](/images/resource/blockviewtopic_09.gif?v=1001) |
|
|
![](/images/resource/viewboard_06.gif?v=1001) |
![](/images/resource/viewboard_07.gif?v=1001) |
|
![](/images/resource/viewboard_08.jpg?v=1001) |
![](/images/resource/viewboard_09.gif?v=1001) |
![](/images/resource/viewboard_01.gif?v=1001) |
|
|
![](/images/resource/viewboard_03.gif?v=1001) |
![](/images/resource/viewboard_04.gif?v=1001) |
|
สำหรับผมไม่ยากครับ
Android and ListView : Android and ListView
|
![](/images/resource/blockviewtopic_01.gif?v=1001) |
![](/images/resource/blockviewtopic_02.gif?v=1001) |
![](/images/resource/blockviewtopic_03.gif?v=1001) |
![](/images/resource/blockviewtopic_04.gif?v=1001) |
Date :
2016-09-22 11:33:32 |
By :
mr.win |
|
![](/images/resource/blockviewtopic_06.gif?v=1001) |
![](/images/resource/blockviewtopic_07.gif?v=1001) |
![](/images/resource/blockviewtopic_08.gif?v=1001) |
![](/images/resource/blockviewtopic_09.gif?v=1001) |
|
|
![](/images/resource/viewboard_06.gif?v=1001) |
![](/images/resource/viewboard_07.gif?v=1001) |
|
![](/images/resource/viewboard_08.jpg?v=1001) |
![](/images/resource/viewboard_09.gif?v=1001) |
|
|
|
![](/images/digitalocean-banner.jpg)
|
Load balance : Server 03
|