1
我拉從前一頁的訂單ID從表中選擇特定的順序,並且工作正常。我還需要從該表中獲取CustomerID並查詢客戶表以返回具有該ID的條目。在兩個不同的表中的webmatrix動態sql查詢
@{
var id=Request["id"];
var SQLSELECT3 = "SELECT * FROM Ordr WHERE [email protected]";
var db = Database.Open("OMD");
var ordr = db.QuerySingle(SQLSELECT3,id);
var oCustomerID=ordr.CustomerID;
var oStatus=ordr.Status;
var oID=ordr.ID;
var oDate=ordr.Date;
var oService=ordr.Service;
var oNotes=ordr.Notes;
var SQLSELECT = "SELECT * FROM Customer WHERE ID = @oCustomerID";
var customer = db.QuerySingle(SQLSELECT,id);
var cLastName=customer.LastName;
var cFirstName=customer.FirstName;
var cAddress=customer.Address;
var cCity=customer.City;
var cState=customer.State;
var cZip=customer.Zip;
var cPhone1=customer.Phone1;
var cPhone2=customer.Phone2;
var cEmail=customer.Email;
}
這工作,除了它不能將字符串轉換爲INT,所以我刪除了該部分,它很好。非常感謝。它不會讓我投票,因爲我沒有足夠的聲望。 :( – James