本文介绍了有人可以帮我解决这个错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! Compose背后的代码是 受保护 void btnSubmit_Click( object sender,EventArgs e) { try { string date,messagefrom,messageto,message; int employeeid; date = DateTime.Now.ToString(); messagefrom = 来自; messageto = dropTo.SelectedItem.Text; message = txtMessage.Text; DataTable dt = BusinessAccessLayer.Query( 从员工中选择employeeid,其中name =' + messageto + '); if (dt.Rows.Count > 0 ) { employeeid = Convert.ToInt32(dt.Rows [ 0 ] [ employeeid]); string sqlstr = 插入消息值(' + date + ',' + messagefrom + ',' + messageto + ',' + message + ', + employeeid + ,1); BusinessAccessLayer.NonQuery(sqlstr); } Response.Redirect( managermessageoutbox.aspx,假); } catch (例外情况) { lblError.Text = 错误: + ex.Message; } } 解决方案The Code behind Compose message isprotected void btnSubmit_Click(object sender, EventArgs e) { try { string date, messagefrom, messageto, message; int employeeid; date = DateTime.Now.ToString(); messagefrom = from; messageto = dropTo.SelectedItem.Text; message = txtMessage.Text; DataTable dt = BusinessAccessLayer.Query("select employeeid from employees where name='" + messageto + "'"); if (dt.Rows.Count > 0) { employeeid = Convert.ToInt32(dt.Rows[0]["employeeid"]); string sqlstr = "insert into Messages values('" + date + "','" + messagefrom + "','" + messageto + "','" + message + "'," + employeeid + ",1)"; BusinessAccessLayer.NonQuery(sqlstr); } Response.Redirect("managermessageoutbox.aspx", false); } catch (Exception ex) { lblError.Text = "Error: " + ex.Message; } } 解决方案 这篇关于有人可以帮我解决这个错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-23 04:26