日期:2013-10-01  浏览次数:20618 次

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<meta name=vs_targetSchema content="http://schemas.microsoft.com/intellisense/ie5">
<TITLE>客户端DataSet</TITLE>
<SCRIPT>
var iRowIdx = 0;

function init()
{
    services.useService("ClientDataSetDataProvider.asmx?WSDL", "clientdatasetdataprovider");
    loadData();
}
function loadData()
{
    services.clientdatasetdataprovider.callService(loadresult, "GetPubs");
}
function loadresult(result)
{
    if (result.error) {
        alert(result.errorDetail.string);
    }
    else {
        dsPubs.ReadXml(result.value);
        iRowIdx = 0;
        updateButtons();
        dataBind();
    }
}
function dataBind()
{
    var oTable = dsPubs.GetTable("authors");
    if (oTable) {
        var oRow = oTable.GetRow(iRowIdx);
        if (oRow) {
            txtAuthorID.value    = oRow.GetValue("au_id");
            txtFirstName.value    = oRow.GetValue("au_fname");
            txtLastName.value    = oRow.GetValue("au_lname");
            txtPhone.value        = oRow.GetValue("phone");
            txtAddress.value    = oRow.GetValue("address");
            txtCity.value        = oRow.GetValue("city");
            txtState.value        = oRow.GetValue("state");
            txtZip.value        = oRow.GetValue("zip");
            chkContract.checked    = (oRow.GetValue("contract") == "true") ? true : false;
            return;
        }
    }

    txtAuthorID.value    = "";
    txtFirstName.value    = "";
    txtLastName.value    = "";
    txtPhone.value        = "";
    txtAddress.value    = "";
    txtCity.value        = "";
    txtState.value        = "";
    txtZip.value        = "";