C# 语言 最好  下面类似的
这个是别人写的 应该有些问题 其中现面两个 我不知道怎么写  呵呵 我很差的
public void Update(string mode,ref webbase.DsCustomSMS dataSet )
{
                           mode 表示是删除 修改,添加记录等操作
                             
// dataSet = (webbase.DsCustomSMS)dataSet;
}
public void FillByID(ref webbase.DsCustomSMS dataSet ,
string CustomSMSGUID )
{
//按照ID Fill
}using System;
using System.Data;
using System.ComponentModel;
using System.Collections;
using System.Diagnostics;namespace webbase
{
/// <summary>
/// CustomSMSBR 的摘要说明。
/// </summary>
public class CustomSMSBR : System.ComponentModel.Component
{
private System.Data.SqlClient.SqlDataAdapter sqlDataAdapter1;
private System.Data.SqlClient.SqlCommand sqlSelectCommand1;
private System.Data.SqlClient.SqlConnection sqlConnection1;
private System.Data.SqlClient.SqlDataAdapter sqlDataAdapter2;
private System.Data.SqlClient.SqlCommand sqlSelectCommand2;
private System.Data.SqlClient.SqlCommand sqlInsertCommand1;
private System.Data.SqlClient.SqlCommand sqlUpdateCommand1;
private System.Data.SqlClient.SqlCommand sqlDeleteCommand1;
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null; public CustomSMSBR(System.ComponentModel.IContainer container)
{
///
/// Windows.Forms 类撰写设计器支持所必需的
///
container.Add(this);
InitializeComponent(); //
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
} public CustomSMSBR()
{
///
/// Windows.Forms 类撰写设计器支持所必需的
///
InitializeComponent(); //
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
} public void Update(string mode,ref webbase.DsCustomSMS dataSet )
{
// dataSet = (webbase.DsCustomSMS)dataSet;
}

public int GetRecordCount( )
{
webbase.DsCustomSMS dataSet = null;
sqlDataAdapter1.Fill( dataSet);
return dataSet.T_CommonSMS.Count;
} public void FillPage(ref webbase.DsCustomSMS dataSet ,
int startRow ,
int maxRows )
{
sqlDataAdapter1.Fill(dataSet,startRow, maxRows, "T_CommonSMS");
} public void Fill( ref webbase.DsCustomSMS dataSet )
{
sqlDataAdapter1.Fill(dataSet); // for(int i = 0 ; i < dataSet.T_CommonSMS.Columns.Count; i++ )
// {
dataSet.T_CommonSMS.Columns[2].Caption="短信";
dataSet.T_CommonSMS.Columns[3].Caption="状态";
dataSet.T_CommonSMS.Columns[4].Caption="类型";
//
// for(int i = 0; i < dataSet.T_CommonSMS.Columns.Count ; i ++)
// {
// dataSet.T_CommonSMS.Columns[i].Caption = "列"+i;
// }
// } }

public void FillByID(ref webbase.DsCustomSMS dataSet ,
string CustomSMSGUID )
{
// webbase.DsCustomSMS dataSet2 = new DsCustomSMS(); 
sqlDataAdapter1.Fill(dataSet); while (dataSet.T_CommonSMS.Rows.Count>1)
{
dataSet.T_CommonSMS.Rows.RemoveAt(1);
}// if (dataSet2.T_CommonSMS.Rows.Count>0)
// dataSet2.T_CommonSMS.Rows.CopyTo( dataSet.T_CommonSMS.Rows,1);
}// int GetRecordCountByXBID( Guid xBID );
//
// int FillPageByXBID( webbase.DsCustomSMS dataSet ,
// Guid xBID ,
// int startRow ,
// int maxRows );
// int FillByXBID( webbase.DsCustomSMS dataSet ,
// Guid xBID );

/// <summary> 
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region 组件设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>

解决方案 »

  1.   

    private void InitializeComponent()
    {
    this.sqlDataAdapter1 = new System.Data.SqlClient.SqlDataAdapter();
    this.sqlSelectCommand1 = new System.Data.SqlClient.SqlCommand();
    this.sqlConnection1 = new System.Data.SqlClient.SqlConnection();
    this.sqlDataAdapter2 = new System.Data.SqlClient.SqlDataAdapter();
    this.sqlDeleteCommand1 = new System.Data.SqlClient.SqlCommand();
    this.sqlInsertCommand1 = new System.Data.SqlClient.SqlCommand();
    this.sqlSelectCommand2 = new System.Data.SqlClient.SqlCommand();
    this.sqlUpdateCommand1 = new System.Data.SqlClient.SqlCommand();
    // 
    // sqlDataAdapter1
    // 
    this.sqlDataAdapter1.SelectCommand = this.sqlSelectCommand1;
    this.sqlDataAdapter1.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] {
      new System.Data.Common.DataTableMapping("Table", "T_CommonSMS", new System.Data.Common.DataColumnMapping[] {
     new System.Data.Common.DataColumnMapping("F_Comm_GUID", "F_Comm_GUID"),
     new System.Data.Common.DataColumnMapping("F_Group_GUID", "F_Group_GUID"),
     new System.Data.Common.DataColumnMapping("F_Comm_Context", "F_Comm_Context"),
     new System.Data.Common.DataColumnMapping("F_Comm_Status", "F_Comm_Status"),
     new System.Data.Common.DataColumnMapping("F_Group_Name", "F_Group_Name")})});
    // 
    // sqlSelectCommand1
    // 
    this.sqlSelectCommand1.CommandText = "SELECT T_CommonSMS.F_Comm_GUID, T_CommonSMS.F_Group_GUID, T_CommonSMS.F_Comm_Cont" +
    "ext, T_CommonSMS.F_Comm_Status, T_CommonSMSGroup.F_Group_Name FROM T_CommonSMS I" +
    "NNER JOIN T_CommonSMSGroup ON T_CommonSMS.F_Group_GUID = T_CommonSMSGroup.F_Grou" +
    "p_GUID";
    this.sqlSelectCommand1.Connection = this.sqlConnection1;
    // 
    // sqlConnection1
    // 
    this.sqlConnection1.ConnectionString = "workstation id=YANG_YYH;packet size=4096;user id=sa;data source=eosserver;persist" +
    " security info=False;initial catalog=SMS;;password=sqleos";
    // 
    // sqlDataAdapter2
    // 
    this.sqlDataAdapter2.DeleteCommand = this.sqlDeleteCommand1;
    this.sqlDataAdapter2.InsertCommand = this.sqlInsertCommand1;
    this.sqlDataAdapter2.SelectCommand = this.sqlSelectCommand2;
    this.sqlDataAdapter2.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] {
      new System.Data.Common.DataTableMapping("Table", "T_CommonSMSGroup", new System.Data.Common.DataColumnMapping[] {
      new System.Data.Common.DataColumnMapping("F_Group_GUID", "F_Group_GUID"),
      new System.Data.Common.DataColumnMapping("F_Group_Name", "F_Group_Name"),
      new System.Data.Common.DataColumnMapping("F_Group_Status", "F_Group_Status")})});
    this.sqlDataAdapter2.UpdateCommand = this.sqlUpdateCommand1;
    // 
    // sqlDeleteCommand1
    // 
    this.sqlDeleteCommand1.CommandText = "DELETE FROM T_CommonSMSGroup WHERE (F_Group_GUID = @Original_F_Group_GUID) AND (F" +
    "_Group_Name = @Original_F_Group_Name) AND (F_Group_Status = @Original_F_Group_St" +
    "atus OR @Original_F_Group_Status IS NULL AND F_Group_Status IS NULL)";
    this.sqlDeleteCommand1.Connection = this.sqlConnection1;
    this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_F_Group_GUID", System.Data.SqlDbType.VarChar, 36, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "F_Group_GUID", System.Data.DataRowVersion.Original, null));
    this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_F_Group_Name", System.Data.SqlDbType.VarChar, 55, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "F_Group_Name", System.Data.DataRowVersion.Original, null));
    this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_F_Group_Status", System.Data.SqlDbType.VarChar, 1, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "F_Group_Status", System.Data.DataRowVersion.Original, null));
    // 
    // sqlInsertCommand1
    // 
    this.sqlInsertCommand1.CommandText = "INSERT INTO T_CommonSMSGroup(F_Group_GUID, F_Group_Name, F_Group_Status) VALUES (" +
    "@F_Group_GUID, @F_Group_Name, @F_Group_Status); SELECT F_Group_GUID, F_Group_Nam" +
    "e, F_Group_Status FROM T_CommonSMSGroup WHERE (F_Group_GUID = @F_Group_GUID)";
    this.sqlInsertCommand1.Connection = this.sqlConnection1;
    this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@F_Group_GUID", System.Data.SqlDbType.VarChar, 36, "F_Group_GUID"));
    this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@F_Group_Name", System.Data.SqlDbType.VarChar, 55, "F_Group_Name"));
    this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@F_Group_Status", System.Data.SqlDbType.VarChar, 1, "F_Group_Status"));
    // 
    // sqlSelectCommand2
    // 
    this.sqlSelectCommand2.CommandText = "SELECT F_Group_GUID, F_Group_Name, F_Group_Status FROM T_CommonSMSGroup";
    this.sqlSelectCommand2.Connection = this.sqlConnection1;
    // 
    // sqlUpdateCommand1
    // 
    this.sqlUpdateCommand1.CommandText = @"UPDATE T_CommonSMSGroup SET F_Group_GUID = @F_Group_GUID, F_Group_Name = @F_Group_Name, F_Group_Status = @F_Group_Status WHERE (F_Group_GUID = @Original_F_Group_GUID) AND (F_Group_Name = @Original_F_Group_Name) AND (F_Group_Status = @Original_F_Group_Status OR @Original_F_Group_Status IS NULL AND F_Group_Status IS NULL); SELECT F_Group_GUID, F_Group_Name, F_Group_Status FROM T_CommonSMSGroup WHERE (F_Group_GUID = @F_Group_GUID)";
    this.sqlUpdateCommand1.Connection = this.sqlConnection1;
    this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@F_Group_GUID", System.Data.SqlDbType.VarChar, 36, "F_Group_GUID"));
    this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@F_Group_Name", System.Data.SqlDbType.VarChar, 55, "F_Group_Name"));
    this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@F_Group_Status", System.Data.SqlDbType.VarChar, 1, "F_Group_Status"));
    this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_F_Group_GUID", System.Data.SqlDbType.VarChar, 36, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "F_Group_GUID", System.Data.DataRowVersion.Original, null));
    this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_F_Group_Name", System.Data.SqlDbType.VarChar, 55, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "F_Group_Name", System.Data.DataRowVersion.Original, null));
    this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_F_Group_Status", System.Data.SqlDbType.VarChar, 1, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "F_Group_Status", System.Data.DataRowVersion.Original, null)); }
    #endregion
    }