将值从查询表存储到数据库

编程入门 行业动态 更新时间:2024-10-26 22:25:01
本文介绍了将值从查询表存储到数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在我的asp C#网站创建一个查询表单。使用sql server i想要将我表单中输入的值存储到数据库中.... 任何人都可以帮我这个... 请帮帮我

I am creating a Enquiry form in my asp C# website..Using sql server i want to stored the values enterd in my form to database.... can anyone help me about this... please help me out

推荐答案

首先你在数据库中创建表.. 然后使用sql查询将值插入表中.. first you create table in database.. then use sql query to insert values in to the table..

首先你必须创建sql表和必要的sps 。 这里附上一个简单的例子。 Hi, First you have to create sql tables and needful sps. here iam attaching a simple example. Create procedure insert (@ColumnValue1,@ColumnValue2,@ColumnValue3) { insert into tablename (Column1,Column2,Column3) values(@ColumnValue1,@ColumnValue2,@ColumnValue3) }

part--创建一个向db插入值的方法,并从提交按钮单击调用此方法,或者在按钮单击内写入完整代码。

part-- create a method for inserting values to db and call this method from the submit button click or you cam writethe full code inside the button click.

SqlConnection con=new sqlconnection("give ur connection string here"); sqlcommand cmd=new sqlcommand(); con.open(); cmd=new sqlcommand("insert",con); cmdmandtype=commandtype.storedprocedure; cmd.parameters.addwithvalue("@ColumnValue1",txtbox1.text); cmd.parameters.addwithvalue("@ColumnValue2",txtbox2.text); cmd.parameters.addwithvalue("@ColumnValue3",txtbox3.text); cmd.ExecuteNonQuery(); con.close();

希望这可以帮助您获得基本想法。

Hope this will help you to get a basic idea.

更多推荐

将值从查询表存储到数据库

本文发布于:2023-10-22 23:17:51,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1519021.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:数据库

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!