测试程序 出了问题一时没看出来 那儿错误
调用存储过程的方法感觉不对 ,不知道错在那儿 。只好写个 通用的
public
string
execStoredProcedure(
string
PostID)
... {
string result = string.Empty;
if (PostID.Length > 0)
...{
string mySqlString;
mySqlString = "sp_AddNewTag2TagBound";
SqlCommand mySC = new SqlCommand(mySqlString, mySqlConnection);
mySC.CommandType = CommandType.StoredProcedure;
SqlParameter param = new SqlParameter("@PostID",SqlDbType.NVarChar,25);
param.Value = PostID;
mySC.Parameters.Add(param);
try
...{
if (mySqlConnection.State == ConnectionState.Open)
...{}
else
...{
mySqlConnection.Open();
}
mySC.ExecuteNonQuery();
result = "OK";
}
catch (Exception e)
...{
result = e.Message;
Log.Write(result);
}
}
else
...{
result = "岗位ID为空";
}
if (mySqlConnection.State == ConnectionState.Open)
...{
mySqlConnection.Close();
}
return result;
}
... {
string result = string.Empty;
if (PostID.Length > 0)
...{
string mySqlString;
mySqlString = "sp_AddNewTag2TagBound";
SqlCommand mySC = new SqlCommand(mySqlString, mySqlConnection);
mySC.CommandType = CommandType.StoredProcedure;
SqlParameter param = new SqlParameter("@PostID",SqlDbType.NVarChar,25);
param.Value = PostID;
mySC.Parameters.Add(param);
try
...{
if (mySqlConnection.State == ConnectionState.Open)
...{}
else
...{
mySqlConnection.Open();
}
mySC.ExecuteNonQuery();
result = "OK";
}
catch (Exception e)
...{
result = e.Message;
Log.Write(result);
}
}
else
...{
result = "岗位ID为空";
}
if (mySqlConnection.State == ConnectionState.Open)
...{
mySqlConnection.Close();
}
return result;
}