紧急求助!这一段C#SQL代码用C++如何实现?

//检测routing
private void button2_Click(object sender, EventArgs e)
{
lock (objLock)//COMPSN_P80
{
string strConn = "Data Source=172.26.40.6;Initial Catalog=PAL_COMPSN_P80;User ID=TestUser;Password=Test*#PWD";
string sql = "MonitorPortal";

    SqlConnection conn = new SqlConnection(strConn);
    SqlCommand cmd = new SqlCommand(sql, conn);

    cmd.CommandType = CommandType.StoredProcedure;
    cmd.Parameters.Add(new SqlParameter("@BU", SqlDbType.VarChar, 10));
    cmd.Parameters.Add(new SqlParameter("@Station", SqlDbType.VarChar, 10));
    cmd.Parameters.Add(new SqlParameter("@Step", SqlDbType.VarChar, 20));
    cmd.Parameters.Add(new SqlParameter("@InPutStr", SqlDbType.VarChar, 1000));
    cmd.Parameters.Add(new SqlParameter("@OutPutStr", SqlDbType.VarChar, 300));
    //Init Parameter
    cmd.Parameters["@BU"].Value = "PU6_SZ";//
    cmd.Parameters["@Station"].Value = "AJUV";//
    cmd.Parameters["@Step"].Value = "Request";//
    cmd.Parameters["@InPutStr"].Value = "Top Case=" + textBox_SN.Text + ";$;Line=A16";//
    cmd.Parameters["@OutPutStr"].Direction = ParameterDirection.Output;
    try
    {
        conn.Open();
        cmd.ExecuteNonQuery();
        textBox_Routing.Text = cmd.Parameters["@OutPutStr"].Value.ToString();
    }
    catch (Exception)
    {
        throw;
    }
    finally
    {
        conn.Close();
    }
}

}

1个回答

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐