Implement a client-side dataset-----ClientDataSetDataProvider.asmx.cs (2)
Last Update:2017-02-28
Source: Internet
Author: User
Client| Client//
M_cmdauthorsdelete
//
This.m_cmdAuthorsDelete.CommandText = @ "DELETE from authors WHERE (au_id = @au_id) and (address = @address OR @address1 is NULL and address are null) and (au_fname = @au_fname) and (au_lname = @au_lname) and (city = @city OR @city1 is null and C ity is null) and (contract = @contract) and (phone = @phone) and (state = @state OR @state1 are null and state is null) and (Zip = @zip OR @zip1 is null and zip is null);
This.m_cmdAuthorsDelete.Connection = This.m_con;
THIS.M_CMDAUTHORSDELETE.PARAMETERS.ADD (New System.Data.SqlClient.SqlParameter ("@au_id", System.Data.SqlDbType.Char, one, System.Data.ParameterDirection.Input, False ((System.Byte) (0)), ((System.Byte) (0)) , "au_id", System.Data.DataRowVersion.Original, null));
THIS.M_CMDAUTHORSDELETE.PARAMETERS.ADD (New System.Data.SqlClient.SqlParameter ("@address", System.Data.SqlDbType.VarChar, System.Data.ParameterDirection.Input, True, ((System.Byte) (0)), ((System.Byte) (0 ), "Address", System.Data.DataRowVersion.Original, NULL);
THIS.M_CMDAUTHORSDELETE.PARAMETERS.ADD (New System.Data.SqlClient.SqlParameter ("@address1", System.Data.SqlDbType.VarChar, System.Data.ParameterDirection.Input, True, ((System.Byte) (0)), ((System.Byte) (0 ), "Address", System.Data.DataRowVersion.Original, NULL);
THIS.M_CMDAUTHORSDELETE.PARAMETERS.ADD (New System.Data.SqlClient.SqlParameter ("@au_fname", System.Data.SqlDbType.VarChar, System.Data.ParameterDirection.Input, False, ((System.Byte) (0)), ((System.Byte) ( 0)), "au_fname", System.Data.DataRowVersion.Original, NULL);
THIS.M_CMDAUTHORSDELETE.PARAMETERS.ADD (New System.Data.SqlClient.SqlParameter ("@au_lname", System.Data.SqlDbType.VarChar, System.Data.ParameterDirection.Input, False, ((System.Byte) (0)), ((System.Byte) ( 0)), "au_lname", System.Data.DataRowVersion.Original, NULL);
THIS.M_CMDAUTHORSDELETE.PARAMETERS.ADD (New System.Data.SqlClient.SqlParameter ("@city", System.Data.SqlDbType.VarChar, System.Data.ParameterDirection.Input, True, ((System.Byte) (0)), ((System.Byte) (0 ), "City", System.Data.DataRowVersion.Original, NULL);
THIS.M_CMDAUTHORSDELETE.PARAMETERS.ADD (New System.Data.SqlClient.SqlParameter ("@city1", System.Data.SqlDbType.VarChar, System.Data.ParameterDirection.Input, True, ((System.Byte) (0)), ((System.Byte) (0 ), "City", System.Data.DataRowVersion.Original, NULL);
THIS.M_CMDAUTHORSDELETE.PARAMETERS.ADD (New System.Data.SqlClient.SqlParameter ("@contract", System.Data.SqlDbType.Bit, 1, System.Data.ParameterDirection.Input, False, ((System.Byte) (0)), ((System.Byte) (0)), " Contract ", System.Data.DataRowVersion.Original, null));
THIS.M_CMDAUTHORSDELETE.PARAMETERS.ADD (New System.Data.SqlClient.SqlParameter ("@phone", System.Data.SqlDbType.Char, System.Data.ParameterDirection.Input, False, ((System.Byte) (0)), ((System.Byte) (0)) , "Phone", System.Data.DataRowVersion.Original, NULL);
THIS.M_CMDAUTHORSDELETE.PARAMETERS.ADD (New System.Data.SqlClient.SqlParameter ("@state", System.Data.SqlDbType.Char, 2, System.Data.ParameterDirection.Input, True, ((System.Byte) (0)), ((System.Byte) (0)), " State ", System.Data.DataRowVersion.Original, null));
THIS.M_CMDAUTHORSDELETE.PARAMETERS.ADD (New System.Data.SqlClient.SqlParameter ("@state1", System.Data.SqlDbType.Char, 2, System.Data.ParameterDirection.Input, True, ((System.Byte) (0)), ((System.Byte) (0)), " State ", System.Data.DataRowVersion.Original, null));
THIS.M_CMDAUTHORSDELETE.PARAMETERS.ADD (New System.Data.SqlClient.SqlParameter ("@zip", System.Data.SqlDbType.Char , 5, System.Data.ParameterDirection.Input, True, ((System.Byte) (0)), ((System.Byte) (0)), "Zip", System.Data.DataRowVersion.Original, null));
THIS.M_CMDAUTHORSDELETE.PARAMETERS.ADD (New System.Data.SqlClient.SqlParameter ("@zip1", System.Data.SqlDbType.Char, 5, System.Data.ParameterDirection.Input, True, ((System.Byte) (0)), ((System.Byte) (0)), " Zip ", System.Data.DataRowVersion.Original, null));
//
M_authorsadapter
//
This.m_AuthorsAdapter.DeleteCommand = This.m_cmdauthorsdelete;
This.m_AuthorsAdapter.InsertCommand = This.m_cmdauthorsinsert;
This.m_AuthorsAdapter.SelectCommand = This.m_cmdauthorsselect;
This.m_AuthorsAdapter.TableMappings.AddRange (new system.data.common.datatablemapping[] {
New System.Data.Common.DataTableMapping ("Table", "authors", new system.data.common.datacolumnmapping[] {
New System.Data.Common.DataColumnMapping ("au_id", "au_id"),
New System.Data.Common.DataColumnMapping ("au_lname", "au_lname"),
New System.Data.Common.DataColumnMapping ("au_fname", "au_fname"),
New System.Data.Common.DataColumnMapping ("Phone", "phone"),
New System.Data.Common.DataColumnMapping ("Address", "address"),
New System.Data.Common.DataColumnMapping ("City", "City"),
New System.Data.Common.DataColumnMapping ("state", "state"),
New System.Data.Common.DataColumnMapping ("Zip", "zip"),
New System.Data.Common.DataColumnMapping ("Contract", "Contract")});
This.m_AuthorsAdapter.UpdateCommand = this.m_cmdauthorsupdate;
//
M_pubsdataset
//
This.m_PubsDataSet.DataSetName = "Pubs";
This.m_PubsDataSet.Locale = new System.Globalization.CultureInfo ("en-us");
((System.ComponentModel.ISupportInitialize) (This.m_pubsdataset)). EndInit ();
}
#endregion
<summary>
Clean up any being used.
</summary>
protected override void Dispose (bool disposing)
{
}
[
WebMethod
]
Public DataSet getpubs ()
{
M_con. Open ();
Try
{
M_authorsadapter.fill (M_pubsdataset);
}
Finally
{
M_con. Close ();
}
return m_pubsdataset;
}
[
WebMethod
]
public void SaveChanges (DataSet dspubs)
{
M_con. Open ();
Try
{
M_authorsadapter.update (dspubs);
}
Finally
{
M_con. Close ();
}
}
}
}