日期:2014-05-18 浏览次数:20864 次
public int procomAddress(string comtext,int fid,string str_linkname) { int i = 0; using (sqlcom) { try { sqlcom.CommandType = CommandType.StoredProcedure; sqlcom.CommandText = comtext; SqlParameter[] prams = { new SqlParameter("@fid",SqlDbType.Int), new SqlParameter("@file_file",SqlDbType.VarChar,100), new SqlParameter("@ret",SqlDbType.Int) }; prams[0].Value = fid; prams[1].Value = str_linkname; prams[2].Direction = ParameterDirection.Output; foreach (SqlParameter parmameter in prams) { sqlcom.Parameters.Add(parmameter); } //SqlParameter sqlpar = sqlcom.Parameters.Add("@Return", SqlDbType.Int); // sqlpar.Direction = ParameterDirection.ReturnValue; sqlcom.ExecuteNonQuery(); i = Convert.ToInt16(sqlcom.Parameters["@ret"].Value.ToString()); sqlcom.Dispose(); return i; } catch (Exception eu) { MessageBox.Show("信息有误!"); MessageBox.Show(eu.ToString()); return i; } } }