实现一个客户端的DataSet-----index.htm
来源:互联网 发布:淘宝上营业执照是外地 编辑:程序博客网 时间:2024/06/16 02:07
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<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 = "";
chkContract.value = false;
}
function text_onBlur()
{
var sDataFld = event.srcElement.getAttribute("datafld");
var oTable = dsPubs.GetTable("authors");
if (oTable) {
var oRow = oTable.GetRow(iRowIdx);
if (oRow) {
oRow.SetValue(sDataFld, event.srcElement.value);
}
}
}
function checkbox_onBlur()
{
var sDataFld = event.srcElement.getAttribute("datafld");
var oTable = dsPubs.GetTable("authors");
if (oTable) {
var oRow = oTable.GetRow(iRowIdx);
if (oRow) {
oRow.SetValue(sDataFld, event.srcElement.checked.toString().toLowerCase());
}
}
}
function updateButtons()
{
var oTable = dsPubs.GetTable("authors");
if (oTable) {
var cRows = oTable.GetRowCount();
if (iRowIdx == 0 || cRows == 0) {
btnFirst.disabled = true;
btnPrev.disabled = true;
}
else {
btnFirst.disabled = false;
btnPrev.disabled = false;
}
if (iRowIdx < cRows-1) {
btnNext.disabled = false;
btnLast.disabled = false;
}
else {
btnNext.disabled = true;
btnLast.disabled = true;
}
if (cRows > 0) {
btnDelete.disabled = false;
}
else {
btnDelete.disabled = true;
}
}
else {
btnFirst.disabled = true;
btnPrev.disabled = true;
btnNext.disabled = true;
btnLast.disabled = true;
btnAdd.disabled = true;
btnDelete.disabled = true;
}
}
function btnSave_onClick()
{
var dsChanges = dsPubs.GetChanges();
services.clientDataSetdataprovider.callService(saveresult, "SaveChanges", dsChanges);
}
function saveresult(result)
{
if (result.error) {
alert(result.errorDetail.string);
dsPubs.RejectChanges();
}
else {
alert("数据已保存!");
dsPubs.AcceptChanges();
}
updateButtons();
dataBind();
}
function btnFirst_onClick()
{
iRowIdx = 0;
updateButtons();
dataBind();
}
function btnPrev_onClick()
{
iRowIdx--;
if (iRowIdx < 0) iRowIdx = 0;
updateButtons();
dataBind();
}
function btnNext_onClick()
{
var oTable = dsPubs.GetTable("authors");
if (oTable) {
var cRows = oTable.GetRowCount();
iRowIdx++;
if (iRowIdx >= cRows) iRowIdx = cRows - 1;
updateButtons();
dataBind();
}
}
function btnLast_onClick()
{
var oTable = dsPubs.GetTable("authors");
if (oTable) {
var cRows = oTable.GetRowCount();
iRowIdx = cRows - 1;
updateButtons();
dataBind();
}
}
function btnAdd_onClick()
{
var oTable = dsPubs.GetTable("authors");
if (oTable) {
var oRow = oTable.AddRow();
iRowIdx = oTable.GetRowCount()-1;
updateButtons();
dataBind();
}
}
function btnDelete_onClick()
{
var oTable = dsPubs.GetTable("authors");
if (oTable) {
oTable.GetRow(iRowIdx).Delete();
oTable = dsPubs.GetTable("authors");
var cRows = oTable.GetRowCount();
if (iRowIdx >= cRows) iRowIdx = cRows - 1;
updateButtons();
dataBind();
}
}
function btnGetChanges_onClick()
{
var oDoc = dsPubs.GetChanges();
var oDiff = oDoc.selectSingleNode("//diffgr:diffgram");
txtDebug.value = oDiff.xml;
}
function btnAcceptChanges_onClick()
{
dsPubs.AcceptChanges();
txtDebug.value = dsPubs.XmlData.xml;
}
function btnRejectChanges_onClick()
{
dsPubs.RejectChanges();
txtDebug.value = dsPubs.XmlData.xml;
}
window.attachEvent("onload", init);
</SCRIPT>
</HEAD>
<BODY>
<table cellspacing=0 cellpadding=10 border=0>
<tr>
<td align=left valign=top>
<b>Author ID:</b><br>
<input id=txtAuthorID type=text datafld="au_id" onblur="text_onBlur()"><br><br>
<b>First Name:</b><br>
<input id="txtFirstName" type=text datafld="au_fname" onblur="text_onBlur()"><br><br>
<b>Last Name:</b><br>
<input id="txtLastName" type=text datafld="au_lname" onblur="text_onBlur()"><br><br>
</td>
<td align=left valign=top>
<b>Phone:</b><br>
<input id="txtPhone" type=text datafld="phone" onblur="text_onBlur()"><br><br>
<b>Address:</b><br>
<input id="txtAddress" type=text datafld="address" onblur="text_onBlur()"><br><br>
<b>City:</b><br>
<input id="txtCity" type=text datafld="city" onblur="text_onBlur()"><br><br>
</td>
<td align=left valign=top>
<b>State:</b><br>
<input id="txtState" type=text datafld="state" onblur="text_onBlur()"><br><br>
<b>Zip:</b><br>
<input id="txtZip" type=text datafld="zip" onblur="text_onBlur()"><br><br>
<b>Contract:</b><input id="chkContract" type=checkbox datafld="contract" onblur="checkbox_onBlur()"><br><br>
</td>
</tr>
</table>
<hr>
<table width="100%">
<tr>
<td align=left valign=top>
<input id="btnFirst" type=button value="First" onclick="btnFirst_onClick()">
<input id="btnPrev" type=button value="Prev" onclick="btnPrev_onClick()">
<input id="btnNext" type= button value="Next" onclick="btnNext_onClick()">
<input id="btnLast" type= button value="Last" onclick="btnLast_onClick()">
<input id="btnAdd" type=button value="Add" onclick="btnAdd_onClick()">
<input id="btnDelete" type=button value="Delete" onclick="btnDelete_onClick()">
</td>
<td align=right valign=top>
<input id="btnGetChanges" type=button value="GetChanges" onclick="btnGetChanges_onClick()">
<input id="btnAcceptChanges" type=button value="AcceptChanges" onclick="btnAcceptChanges_onClick()">
<input id="btnRejectChanges" type=button value="RejectChanges" onclick="btnRejectChanges_onClick()">
<input id="btnSave" type=button value="Save" onclick="btnSave_onClick()">
</td>
</tr>
</table>
<hr>
<textarea id=txtDebug rows=20 style="width:100%;">
</textarea>
<div id="services" style="behavior:url(WebService.htc)" showprogress=true></div>
<div id="dsPubs" style="behavior:url(ClientDataSet.htc)"></div>
</BODY>
<
实现一个客户端的DataSet-----index.htm';return true">
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<!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 = "";
chkContract.value = false;
}
function text_onBlur()
{
var sDataFld = event.srcElement.getAttribute("datafld");
var oTable = dsPubs.GetTable("authors");
if (oTable) {
var oRow = oTable.GetRow(iRowIdx);
if (oRow) {
oRow.SetValue(sDataFld, event.srcElement.value);
}
}
}
function checkbox_onBlur()
{
var sDataFld = event.srcElement.getAttribute("datafld");
var oTable = dsPubs.GetTable("authors");
if (oTable) {
var oRow = oTable.GetRow(iRowIdx);
if (oRow) {
oRow.SetValue(sDataFld, event.srcElement.checked.toString().toLowerCase());
}
}
}
function updateButtons()
{
var oTable = dsPubs.GetTable("authors");
if (oTable) {
var cRows = oTable.GetRowCount();
if (iRowIdx == 0 || cRows == 0) {
btnFirst.disabled = true;
btnPrev.disabled = true;
}
else {
btnFirst.disabled = false;
btnPrev.disabled = false;
}
if (iRowIdx < cRows-1) {
btnNext.disabled = false;
btnLast.disabled = false;
}
else {
btnNext.disabled = true;
btnLast.disabled = true;
}
if (cRows > 0) {
btnDelete.disabled = false;
}
else {
btnDelete.disabled = true;
}
}
else {
btnFirst.disabled = true;
btnPrev.disabled = true;
btnNext.disabled = true;
btnLast.disabled = true;
btnAdd.disabled = true;
btnDelete.disabled = true;
}
}
function btnSave_onClick()
{
var dsChanges = dsPubs.GetChanges();
services.clientDataSetdataprovider.callService(saveresult, "SaveChanges", dsChanges);
}
function saveresult(result)
{
if (result.error) {
alert(result.errorDetail.string);
dsPubs.RejectChanges();
}
else {
alert("数据已保存!");
dsPubs.AcceptChanges();
}
updateButtons();
dataBind();
}
function btnFirst_onClick()
{
iRowIdx = 0;
updateButtons();
dataBind();
}
function btnPrev_onClick()
{
iRowIdx--;
if (iRowIdx < 0) iRowIdx = 0;
updateButtons();
dataBind();
}
function btnNext_onClick()
{
var oTable = dsPubs.GetTable("authors");
if (oTable) {
var cRows = oTable.GetRowCount();
iRowIdx++;
if (iRowIdx >= cRows) iRowIdx = cRows - 1;
updateButtons();
dataBind();
}
}
function btnLast_onClick()
{
var oTable = dsPubs.GetTable("authors");
if (oTable) {
var cRows = oTable.GetRowCount();
iRowIdx = cRows - 1;
updateButtons();
dataBind();
}
}
function btnAdd_onClick()
{
var oTable = dsPubs.GetTable("authors");
if (oTable) {
var oRow = oTable.AddRow();
iRowIdx = oTable.GetRowCount()-1;
updateButtons();
dataBind();
}
}
function btnDelete_onClick()
{
var oTable = dsPubs.GetTable("authors");
if (oTable) {
oTable.GetRow(iRowIdx).Delete();
oTable = dsPubs.GetTable("authors");
var cRows = oTable.GetRowCount();
if (iRowIdx >= cRows) iRowIdx = cRows - 1;
updateButtons();
dataBind();
}
}
function btnGetChanges_onClick()
{
var oDoc = dsPubs.GetChanges();
var oDiff = oDoc.selectSingleNode("//diffgr:diffgram");
txtDebug.value = oDiff.xml;
}
function btnAcceptChanges_onClick()
{
dsPubs.AcceptChanges();
txtDebug.value = dsPubs.XmlData.xml;
}
function btnRejectChanges_onClick()
{
dsPubs.RejectChanges();
txtDebug.value = dsPubs.XmlData.xml;
}
window.attachEvent("onload", init);
</SCRIPT>
</HEAD>
<BODY>
<table cellspacing=0 cellpadding=10 border=0>
<tr>
<td align=left valign=top>
<b>Author ID:</b><br>
<input id=txtAuthorID type=text datafld="au_id" onblur="text_onBlur()"><br><br>
<b>First Name:</b><br>
<input id="txtFirstName" type=text datafld="au_fname" onblur="text_onBlur()"><br><br>
<b>Last Name:</b><br>
<input id="txtLastName" type=text datafld="au_lname" onblur="text_onBlur()"><br><br>
</td>
<td align=left valign=top>
<b>Phone:</b><br>
<input id="txtPhone" type=text datafld="phone" onblur="text_onBlur()"><br><br>
<b>Address:</b><br>
<input id="txtAddress" type=text datafld="address" onblur="text_onBlur()"><br><br>
<b>City:</b><br>
<input id="txtCity" type=text datafld="city" onblur="text_onBlur()"><br><br>
</td>
<td align=left valign=top>
<b>State:</b><br>
<input id="txtState" type=text datafld="state" onblur="text_onBlur()"><br><br>
<b>Zip:</b><br>
<input id="txtZip" type=text datafld="zip" onblur="text_onBlur()"><br><br>
<b>Contract:</b><input id="chkContract" type=checkbox datafld="contract" onblur="checkbox_onBlur()"><br><br>
</td>
</tr>
</table>
<hr>
<table width="100%">
<tr>
<td align=left valign=top>
<input id="btnFirst" type=button value="First" onclick="btnFirst_onClick()">
<input id="btnPrev" type=button value="Prev" onclick="btnPrev_onClick()">
<input id="btnNext" type= button value="Next" onclick="btnNext_onClick()">
<input id="btnLast" type= button value="Last" onclick="btnLast_onClick()">
<input id="btnAdd" type=button value="Add" onclick="btnAdd_onClick()">
<input id="btnDelete" type=button value="Delete" onclick="btnDelete_onClick()">
</td>
<td align=right valign=top>
<input id="btnGetChanges" type=button value="GetChanges" onclick="btnGetChanges_onClick()">
<input id="btnAcceptChanges" type=button value="AcceptChanges" onclick="btnAcceptChanges_onClick()">
<input id="btnRejectChanges" type=button value="RejectChanges" onclick="btnRejectChanges_onClick()">
<input id="btnSave" type=button value="Save" onclick="btnSave_onClick()">
</td>
</tr>
</table>
<hr>
<textarea id=txtDebug rows=20 style="width:100%;">
</textarea>
<div id="services" style="behavior:url(WebService.htc)" showprogress=true></div>
<div id="dsPubs" style="behavior:url(ClientDataSet.htc)"></div>
</BODY>
<
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
- 实现一个客户端的DataSet-----index.htm
- 实现一个客户端的DataSet-----ClientDataSetDataProvider.asmx
- 实现一个客户端的DataSet-----ClientDataSet.htc
- index.htm
- 一个学习编程技术的好网站-http://www.tutorialspoint.com/index.htm
- 一个ftp客户端的实现
- DEDE出现/templets/index.htm Not Found!的解决方法
- 一个倒排索引(inverted index)的python实现
- 一个txt转htm的小程序
- 一个简单的FTP客户端 实现上传下载
- Java实现一个简单的FTP客户端
- 把dataset作为一个xml文件传给客户端
- 把dataset作为一个xml文件传给客户端
- 织梦上传远程出现的问题-----/include/***/templets/default/index.htm Not Found!
- dedecms 数据迁移出现/Web/include/dede/templets/hai666/index.htm Not Found!的解决方法
- 怎样在Visual C# .NET中实现一个DataSet的不同记录的选取(zsxfbj译)
- COBOL access Index dataset sample
- http://www.vantrontech.com/index.htm
- 在PHP中操作MySQL要注意哪些问题?
- 《.net编程先锋C#》第五章 类(下)(转)
- PHP中的正则表达式
- KW大师精品文章赏析
- PHP如何调用JAVA 类库
- 实现一个客户端的DataSet-----index.htm
- 新版mysql+apache+php Linux安装指南
- 实现一个客户端的DataSet-----ClientDataSetDataProvider.asmx
- DOMXML: Expat之外的另一选择
- 《.net编程先锋C#》第一章 C#简介(转)
- PHP模拟SQL Server的两个日期处理函数
- 《.net编程先锋C#》第八章 用C#写组件(转)
- PHP4中的COM函数探讨
- 《.net编程先锋C#》第六章 控制语句(转)