当前位置: 首页>>代码示例>>C#>>正文


C# SqlCommand.Clone方法代码示例

本文整理汇总了C#中System.Data.SqlClient.SqlCommand.Clone方法的典型用法代码示例。如果您正苦于以下问题:C# SqlCommand.Clone方法的具体用法?C# SqlCommand.Clone怎么用?C# SqlCommand.Clone使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Data.SqlClient.SqlCommand的用法示例。


在下文中一共展示了SqlCommand.Clone方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ImgDelete_Click

    protected void ImgDelete_Click(object sender, ImageClickEventArgs e)
    {
        try
        {
            string sql2 = "Delete deposit where [email protected]";
            SqlCommand cmd2 = new SqlCommand();
            cmd2.Connection = cn;
            cmd2.CommandType = CommandType.Text;
            cmd2.CommandText = sql2;

            cmd2.Parameters.AddWithValue("id", LblId.Text);
            cn.Open();
            cmd2.ExecuteNonQuery();

            cmd2.Clone();
            cn.Close();
            depositchk();

        }
        catch
        {

        }
        finally
        {
            cn.Close();

        }
    }
开发者ID:tahirayoub,项目名称:OnlineBankManagementSystem,代码行数:29,代码来源:DepositCheck.aspx.cs

示例2: DBgetimage

        public Bitmap DBgetimage(string sqlString)
        {
            //string sqlString = "select "+filedName+" from "+tableName+" where "+tableIDName+" = '"+tableIdValue+"'";
            byte[] imagebytes = null;
            Bitmap bmpt = null;
            SqlConnection con = new SqlConnection(connectionString);
            con.Open();
            try
            {
                SqlCommand com = new SqlCommand(sqlString, con);
                SqlDataReader dr = com.ExecuteReader();
                while (dr.Read())
                {
                    if (dr.GetValue(0) == DBNull.Value)
                    {
                        return null;
                    }
                    imagebytes = (byte[])dr.GetValue(0);
                }
                dr.Close();
                com.Clone();

                MemoryStream ms = new MemoryStream(imagebytes);
                bmpt = new Bitmap(ms);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            {
                con.Close();
            }
            return bmpt;
        }
开发者ID:d-yh,项目名称:DriverExam,代码行数:35,代码来源:Tool.cs

示例3: ImageButton1_Click

    protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
    {
        try
        {
            if (TxtPassword.Text == "")
            {
                LblError.Visible = true;
                LblError.Text = "Please Enter the Pasword";
                TxtPassword.Focus();
                return;
            }

            cn.Open();
            string sql = "UPDATE Staff SET [email protected]_Name, [email protected]_Name, [email protected], [email protected], [email protected]_Salary,[email protected], [email protected], [email protected], [email protected], [email protected], [email protected]_Number, [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected] where [email protected]";
            SqlCommand cm = new SqlCommand();
            cm.Connection = cn;
            cm.CommandType = CommandType.Text;
            cm.CommandText = sql;

            cm.Parameters.AddWithValue("@Mid", fn);

            cm.Parameters.Add("@First_Name", TxtFirstName.Text);
            cm.Parameters.Add("@Last_Name", TxtLastName.Text);

            cm.Parameters.Add("@Occupation", TxtOccupation.Text);
            cm.Parameters.Add("@Designation", TxtDesignation.Text);
            cm.Parameters.Add("@Monthly_Salary", TxtSalary.Text);
            cm.Parameters.Add("@Email", TxtEmail.Text);
            cm.Parameters.Add("@Address", TxtAddress.Text);
            cm.Parameters.Add("@Country", TxtCountry.Text);
            cm.Parameters.Add("@City", TxtCity.Text);
            cm.Parameters.Add("@PostalCode", TxtPostalCode.Text);
            cm.Parameters.Add("@Phone_Number", TxtPhoneNo.Text);

            cm.Parameters.Add("@Password", EncryptPasswrod(TxtPassword.Text));
            cm.Parameters.Add("@SQ1", TxtQ1.Text);
            cm.Parameters.Add("@Answer1", TxtA1.Text);
            cm.Parameters.Add("@SQ2", TxtQ2.Text);
            cm.Parameters.Add("@Answer2", TxtA2.Text);
            cm.Parameters.Add("@SQ3", TxtQ3.Text);
            cm.Parameters.Add("@Answer3", TxtA3.Text);

            cm.ExecuteNonQuery();

            cm.Clone();
            cn.Close();

            LblError.Visible = true;
            LblError.Text = "Information Updated Successfully";
            getManagerinfo();
        }
        catch
        { }

        finally
        {
            cn.Close();
        }
    }
开发者ID:tahirayoub,项目名称:OnlineBankManagementSystem,代码行数:59,代码来源:StaffSettings.aspx.cs

示例4: NewCmd_dbo_uf_Split

		public static SqlCommand NewCmd_dbo_uf_Split()
		{
			if (_dbo_uf_Split_cmd != null) return _dbo_uf_Split_cmd.Clone();
			_dbo_uf_Split_cmd = new SqlCommand("SELECT * FROM [dbo].[uf_Split](@text, @separator)");
			_dbo_uf_Split_cmd.Parameters.Add(new SqlParameter("text", System.Data.SqlDbType.NVarChar, -1, ParameterDirection.Input, false, 0, 0, "text", DataRowVersion.Current, null));
			_dbo_uf_Split_cmd.Parameters.Add(new SqlParameter("separator", System.Data.SqlDbType.NVarChar, -1, ParameterDirection.Input, false, 0, 0, "separator", DataRowVersion.Current, null));
			return _dbo_uf_Split_cmd.Clone();
		}
开发者ID:TheLegion96,项目名称:fightthelandlord,代码行数:8,代码来源:DC_Function.cs

示例5: NewCmd_usp_Service_Init

		public static SqlCommand NewCmd_usp_Service_Init()
		{
			if (_usp_Service_Init != null) return _usp_Service_Init.Clone();

			_usp_Service_Init = new SqlCommand("[usp].[Service_Init]");
			_usp_Service_Init.CommandType = CommandType.StoredProcedure;
			_usp_Service_Init.Parameters.Add(new SqlParameter("RETURN_VALUE", System.Data.SqlDbType.Int, 0, ParameterDirection.ReturnValue, false, 0, 0, null, DataRowVersion.Current, null));
			return _usp_Service_Init.Clone();
		}
开发者ID:TheLegion96,项目名称:fightthelandlord,代码行数:9,代码来源:DC_StoredProcedure.cs

示例6: DeleteAllCategory

        /// <summary>
        /// Purpose : To Delete All Category Data Into tblcategory.
        /// </summary>
        public void DeleteAllCategory()
        {
            cmd = new SqlCommand("sp_DeleteAllCategory", con);
            cmd.CommandType = CommandType.StoredProcedure;

            con.Open();
            cmd.ExecuteNonQuery();
            cmd.Clone();
        }
开发者ID:Krunal217,项目名称:EBuzz,代码行数:12,代码来源:E_BuzzDataService.cs

示例7: ImageButton1_Click

    protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
    {
        try
        {

            cn.Open();
            string sql = "UPDATE Client SET [email protected]_Name, [email protected]_Name, [email protected], [email protected], [email protected]_Salary,[email protected], [email protected], [email protected], [email protected], [email protected], [email protected]_Number,[email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected] where [email protected]";
            SqlCommand cm = new SqlCommand();
            cm.Connection = cn;
            cm.CommandType = CommandType.Text;
            cm.CommandText = sql;

            cm.Parameters.AddWithValue("@cid", LblClientId.Text);

            cm.Parameters.Add("@First_Name", TxtFirstName.Text);
            cm.Parameters.Add("@Last_Name", TxtLastName.Text);

            cm.Parameters.Add("@Occupation", TxtOccupation.Text);
            cm.Parameters.Add("@Designation", TxtDesignation.Text);
            cm.Parameters.Add("@Monthly_Salary", TxtSalary.Text);
            cm.Parameters.Add("@Email", TxtEmail.Text);
            cm.Parameters.Add("@Address", TxtAddress.Text);
            cm.Parameters.Add("@Country", TxtCountry.Text);
            cm.Parameters.Add("@City", TxtCity.Text);
            cm.Parameters.Add("@PostalCode", TxtPostalCode.Text);
            cm.Parameters.Add("@Phone_Number", TxtPhoneNo.Text);
            cm.Parameters.Add("@Status", TxtStatus.Text);

            cm.Parameters.Add("@SQ1", TxtQ1.Text);
            cm.Parameters.Add("@Answer1", TxtA1.Text);
            cm.Parameters.Add("@SQ2", TxtQ2.Text);
            cm.Parameters.Add("@Answer2", TxtA2.Text);
            cm.Parameters.Add("@SQ3", TxtQ3.Text);
            cm.Parameters.Add("@Answer3", TxtA3.Text);

            cm.ExecuteNonQuery();

            cm.Clone();
            cn.Close();

            LblError.Visible = true;
            Session["label"] = "Information Updated Successfully";
            LblError.Text = Session["label"].ToString();

        }
        catch
        { }

        finally
        {
            cn.Close();
        }
    }
开发者ID:tahirayoub,项目名称:OnlineBankManagementSystem,代码行数:53,代码来源:StaffClientSettings.aspx.cs

示例8: GridView1_RowDeleting

 protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
 {
     string id = GridView1.DataKeys[e.RowIndex].Values[0].ToString();
     string SqlStr = "delete from Sort where sortid='" + id + "'";
     SqlConnection conn = sqlHelper.Connection();//新连接
     SqlCommand comm = new SqlCommand(SqlStr, conn);
     conn.Open();
     comm.ExecuteNonQuery();
     comm.Clone();
     conn.Close();
     GridView1.EditIndex = -1;
     show();
 }
开发者ID:ningboliuwei,项目名称:Course_ASPNET,代码行数:13,代码来源:showSort.aspx.cs

示例9: NewCmd_usp_Service_Insert

		public static SqlCommand NewCmd_usp_Service_Insert()
		{
			if (_usp_Service_Insert != null) return _usp_Service_Insert.Clone();

			_usp_Service_Insert = new SqlCommand("[usp].[Service_Insert]");
			_usp_Service_Insert.CommandType = CommandType.StoredProcedure;
			_usp_Service_Insert.Parameters.Add(new SqlParameter("RETURN_VALUE", System.Data.SqlDbType.Int, 0, ParameterDirection.ReturnValue, false, 0, 0, null, DataRowVersion.Current, null));
			_usp_Service_Insert.Parameters.Add(new SqlParameter("ServiceTypeID", System.Data.SqlDbType.Int, 4, ParameterDirection.Input, false, 10, 0, "ServiceTypeID", DataRowVersion.Current, null));
			_usp_Service_Insert.Parameters.Add(new SqlParameter("CreateTime", System.Data.SqlDbType.DateTime2, 8, ParameterDirection.Input, false, 27, 7, "CreateTime", DataRowVersion.Current, null));
			_usp_Service_Insert.Parameters.Add(new SqlParameter("Name", System.Data.SqlDbType.NVarChar, 50, ParameterDirection.Input, false, 0, 0, "Name", DataRowVersion.Current, null));
			_usp_Service_Insert.Parameters.Add(new SqlParameter("Version", System.Data.SqlDbType.Int, 4, ParameterDirection.Input, false, 10, 0, "Version", DataRowVersion.Current, null));
			_usp_Service_Insert.Parameters.Add(new SqlParameter("FilePath", System.Data.SqlDbType.NVarChar, 250, ParameterDirection.Input, false, 0, 0, "FilePath", DataRowVersion.Current, null));
			_usp_Service_Insert.Parameters.Add(new SqlParameter("Description", System.Data.SqlDbType.NVarChar, -1, ParameterDirection.Input, false, 0, 0, "Description", DataRowVersion.Current, null));
			return _usp_Service_Insert.Clone();
		}
开发者ID:TheLegion96,项目名称:fightthelandlord,代码行数:15,代码来源:DC_StoredProcedure.cs

示例10: GridView1_RowUpdating

        //更新
        protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            string id = GridView1.DataKeys[e.RowIndex].Values[0].ToString();
            string sortname = ((TextBox)GridView1.Rows[e.RowIndex].FindControl("TextBox1")).Text;

            string SqlStr = "update Sort set sortname='"+sortname+"' where sortid='"+id+"'";
            SqlConnection conn = sqlHelper.Connection();//新连接
            SqlCommand comm = new SqlCommand(SqlStr, conn);
            conn.Open();
            comm.ExecuteNonQuery();
            comm.Clone();
            conn.Close();
            GridView1.EditIndex = -1;
            show();
        }
开发者ID:ningboliuwei,项目名称:Course_ASPNET,代码行数:16,代码来源:showSort.aspx.cs

示例11: cmd

    public int cmd(string sqlcumle)
    {
        SqlConnection baglan = this.baglan();
        SqlCommand sorgu = new SqlCommand(sqlcumle, baglan);
        int sonuc = 0;
        try
        {
            sonuc = sorgu.ExecuteNonQuery();
        }
        catch (Exception ex)
        {

            throw new Exception(ex.Message + "(" + sqlcumle + ")");
        }

        sorgu.Dispose();//nesneyle işimiz bıttıgınde kullanılır
        sorgu.Clone();//Clone metodu ile hedef gösterilen dizinin aynısından tüm elemanları ile beraber kopyalanır.
        baglan.Dispose();
        return (sonuc);
    }
开发者ID:Tanjuuralkaya,项目名称:Asp.Net-Emlak-Web-Sitesi,代码行数:20,代码来源:Metodlar.cs

示例12: BtnSubmit_Click

    protected void BtnSubmit_Click(object sender, ImageClickEventArgs e)
    {
        if (TxtPassword.Text != "")
        {
            if (TxtPassword.Text.Length < 3)
            {
                LblError.Visible = true;
                LblError.Text = "Please Enter atleast 3 character length Password";
                TxtPassword.Focus();
                return;
            }
            try
            {
                int i = 0;
                cn.Close();
                string sql22 = "UPDATE Client SET [email protected],[email protected] where [email protected]";
                SqlCommand cmd22 = new SqlCommand();
                cmd22.Connection = cn;
                cmd22.CommandType = CommandType.Text;
                cmd22.CommandText = sql22;
                cmd22.Parameters.AddWithValue("cid", fn);
                cmd22.Parameters.AddWithValue("cc", i);
                cmd22.Parameters.AddWithValue("pwd", EncryptPasswrod(TxtPassword.Text));
                cn.Open();
                cmd22.ExecuteNonQuery();

                cmd22.Clone();
                cn.Close();
                Response.Redirect("~/Client/LoginClient.aspx", false);
            }
            catch
            { }

        }
        else
        {
            TxtPassword.Focus();
            LblError.Visible = true;
            LblError.Text = "Please enter the password";
        }
    }
开发者ID:tahirayoub,项目名称:OnlineBankManagementSystem,代码行数:41,代码来源:ClientCheckPassword.aspx.cs

示例13: ImgUpdate0_Click

    protected void ImgUpdate0_Click(object sender, ImageClickEventArgs e)
    {
        try
        {
            cn.Close();

            int i = 1;

            string sql2 = "UPDATE deposit SET [email protected] where [email protected]";
            SqlCommand cmd2 = new SqlCommand();
            cmd2.Connection = cn;
            cmd2.CommandType = CommandType.Text;
            cmd2.CommandText = sql2;
            cmd2.Parameters.AddWithValue("id", LblId.Text);
            cmd2.Parameters.AddWithValue("cc", i);
            cn.Open();
            cmd2.ExecuteNonQuery();

            cmd2.Clone();
            cn.Close();

            updateclientAccout();
            insertdata2();

        }
        catch
        {

        }
        finally
        {
            cn.Close();

        }
    }
开发者ID:tahirayoub,项目名称:OnlineBankManagementSystem,代码行数:35,代码来源:DepositCheck.aspx.cs

示例14: updateamount2

    void updateamount2()
    {
        try
        {
            getrecipientinfo();
            cn.Close();

            string sql2 = "UPDATE Account SET [email protected] where [email protected]";
            SqlCommand cmd2 = new SqlCommand();
            cmd2.Connection = cn;
            cmd2.CommandType = CommandType.Text;
            cmd2.CommandText = sql2;
            cmd2.Parameters.AddWithValue("cc", amount2);
            cmd2.Parameters.AddWithValue("rac",r_ac);

            cn.Open();
            cmd2.ExecuteNonQuery();

            cmd2.Clone();
            cn.Close();
            LblError.Visible = true;

            LblError.Text = "Successfully Transfered The Amount";

            try
            {
                getclientid();
                getaccountno2();
                cn.Close();
                DateTime statement_date = DateTime.Now;

                string title = "Transfer From : " + latestAcoountNo;
                double d = 0.0;
                cn.Open();
                SqlCommand cm = new SqlCommand(
                "INSERT INTO Statement (Date,Title, Account, credit,debit , Total, Client_Id) VALUES(@Date,@Title, @Account, @credit,@debit, @Total, @Client_Id)", cn);
                cm.Parameters.Add("@Date", statement_date);
                cm.Parameters.Add("@Title", title);
                cm.Parameters.Add("@Account", r_ac);
                cm.Parameters.Add("@credit", TxtAmount.Text);
                cm.Parameters.Add("@debit", d);
                cm.Parameters.Add("@Total", amount2);
                cm.Parameters.Add("@Client_Id", cid1);

                cm.ExecuteNonQuery();

                cm.Clone();

                cn.Close();

                TxtAmount.Text = "";
                LblError.Visible = true;

                LblError.Text = "Successfully Transfered The Amount";

            }

            catch
            {

            }
            finally
            {
                cn.Close();

            }
        }

        catch (Exception ex)
        {

            Response.Write(ex.Message);
        }
        finally
        {
            cn.Close();

        }
    }
开发者ID:tahirayoub,项目名称:OnlineBankManagementSystem,代码行数:79,代码来源:RecipientTransfer.aspx.cs

示例15: updateaccountamount

    void updateaccountamount()
    {
        try
        {
            string sql2 = "UPDATE Account SET [email protected] where [email protected]";
            SqlCommand cmd2 = new SqlCommand();
            cmd2.Connection = cn;
            cmd2.CommandType = CommandType.Text;
            cmd2.CommandText = sql2;
            cmd2.Parameters.AddWithValue("No", LblAccountNo.Text);
            cmd2.Parameters.AddWithValue("amount", sm);
            cn.Open();
            cmd2.ExecuteNonQuery();

            cmd2.Clone();
            cn.Close();
            depositchk();

        }
        catch
        {

        }
        finally
        {
            cn.Close();

        }
    }
开发者ID:tahirayoub,项目名称:OnlineBankManagementSystem,代码行数:29,代码来源:DepositCheck.aspx.cs


注:本文中的System.Data.SqlClient.SqlCommand.Clone方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。