如何使用存储过程从文本框中插入数据? [英] how to insert data using stored procedure from textbox?

查看:81
本文介绍了如何使用存储过程从文本框中插入数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请帮助我

我有这种方法

please help me

I have this method

public void ApllyNonQuery(string Query)
    {
        cmd.CommandText = Query;
        cnn.Open();
        cmd.ExecuteNonQuery();
        cnn.Close();
        cnn.Dispose();
    
    }


和此代码


and this code

string q = "insert into teachers( TchrLastName, TchrFirstName) values(''" +TextBox1.Text   +"'', ''"+TextBox2.Text+"'' ) ";
            db.ApllyNonQuery(q);


我想使用存储过程从文本框中插入数据,如何在SQL中编写数据,以及在这种情况下我的代码会有什么变化

请任何人帮助我,然后再次使用storedprocedure编写我的代码

感谢


I want to use stored procedure to insert data from text box how can I write it in SQL and what changes will be in that case in my codes

please any one help me and write my codes again but by using storedprocedure

thanks

推荐答案

在这里和其他地方有太多关于如何在ADO.NET和ASP.NET中使用存储过程的资源,很难理解您在问这个问题的乳清
With so many resources available here and elsewhere on how to use Stored Procedures with ADO.NET and ASP.NET it is difficult to understand whey you are asking this.


研究存储过程.您可以非常简单地在Google上对其进行搜索
study stored procedures. You can google it very easy


这篇关于如何使用存储过程从文本框中插入数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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