使用sp从接触形式到数据库的信息。 [英] Inser the info from contact form to the db using sp.

查看:66
本文介绍了使用sp从接触形式到数据库的信息。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我创建了一个包含字段名称,电子邮件和消息的联系表单。我有一个保存按钮。我也创建了一个sp来插入工作正常的数据。我在前端面临问题。直到现在我所做的是创建了一个sql连接并添加了一个与我在sp中使用的参数相同的参数。请帮我写一下这段代码。我将非常感谢你的帮助。



我的代码



Hi,

I have created a contact form having field name, email, and message . I have one button for saving it. I have created one sp also to insert the data which is working fine . I am facing problem in front end . Till now what i have done is created a sql connection and added a parameter same which i use in sp. Please help me in writing that code. I will be very Thankful for this help.

My code

SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["contact form"].ToString());
           SqlCommand cmdselect = new SqlCommand();
           cmdselect.CommandType = CommandType.StoredProcedure;
           cmdselect.CommandText = "USP_ContactDetails";
           cmdselect.Parameters.Add("@NAME", SqlDbType.NVarChar, 400).Value = nameinput.Text.Trim();
           cmdselect.Parameters.Add("@EMAIL", SqlDbType.NVarChar, 1000).Value = emailinput.Text.Trim();
           cmdselect.Parameters.Add("@MESSAGE", SqlDbType.NVarChar, 400).Value = textinput.Trim();





关注



Regards

推荐答案

您已经定义了一个命令并将其传递给了一些参数,但你还没有实际执行!!
You have defined a command and passed it some parameters, but you haven't actually executed it!!


这篇关于使用sp从接触形式到数据库的信息。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆