.net调试报错‘..converting the varchar value '..' to a column of data type int.’
报错内容:Syntax error converting the varchar value 'nancy' to a column of data type int.数据库:
程序代码:
CREATE PROCEDURE p_mail_dq @dq varchar(50), @mailms varchar(20) out AS begin if (@dq='上海')or(@dq='外高橋')or(@dq='杭州') begin set @mailms='nancy' end if (@dq='康橋') begin set @mailms='aileen' end if (@dq='松江') begin set @mailms='jessica' end if (@dq='昆山') begin set @mailms='bella' end if (@dq='蘇州') begin set @mailms='anna' end if (@dq='東莞') begin set @mailms='jenni' end if (@dq='成都') begin set @mailms='amy' end return @mailms end GO
程序代码:
string dq = this.txt_dq.Text; string mailm = ""; ESQL.Mail_dqms2(dq, out mailm); mailm = mailm.ToString().Trim();
程序代码:
public static bool Mail_dqms2(string dq,out string mailm) { bool flag = true; SQLHelper sqlhelp = new SQLHelper(); SqlParameter[] par = { sqlhelp.CreateInParam("@dq", SqlDbType.VarChar, 50, dq), sqlhelp.CreateOutParam("@mailms",SqlDbType.VarChar, 200) }; try { sqlhelp.RunProc("p_mail_dq", par); mailm = Convert.ToString(par[1].Value); } catch (Exception ex) { SystemError.CreateErrorLog(ex.Message); throw new Exception(ex.Message, ex); } return flag; }
请问 问题出在哪?前后我都没有设int值也没有转换! 怎么回事