如何在c#中向sql server添加元素数组到数据库中 [英] how to add array of element into database in c# to sql server

查看:241
本文介绍了如何在c#中向sql server添加元素数组到数据库中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这里我有3个文本框和一个添加问题按钮

如果你单击添加问题3文本框将打开,如果你再次点击添加问题再次在那里输入一些东西另外3个文本框将在无限循环中来等等。将这些值存储在数据库sql server中

here i have 3 text box and a add question button
if you click on add question 3 text box will open and u enter something there again if u click add question again 3 more text box will come and so on in a infinite loop .how to store this values in database sql server

推荐答案

请参阅我对该问题的评论。



简短的回答是:当您使用C#标记问题时,您可能使用ASP.NET,这意味着您使用.NET。要访问数据库,您需要使用服务器端,使用ADO.NET:

https:/ /en.wikipedia.org/wiki/ADO.NET [ ^ ],

https://msdn.microsoft.com /en-us/library/aa286484.aspx [ ^ ]。



-SA
Please see my comment to the question.

Short answer is: as you tag your question with "C#", you probably use ASP.NET, it means, you use .NET. To access database, you need to use the server side, with ADO.NET:
https://en.wikipedia.org/wiki/ADO.NET[^],
https://msdn.microsoft.com/en-us/library/aa286484.aspx[^].

—SA


嗯,你需要使用 jQuery AJAX [ ^ ]将值存储在JS中。

参考这篇文章,使用ASP.NET AJAX和jQuery AJAX调用服务器端代码 [ ^ ]。



关于文本框的无限循环,我有一个问题:当这个循环停止时? (可能永远不会,除非你有一些条件,但我没有看到任何情况)考虑一下;)



-KR
Well, you need to use jQuery AJAX[^] to store the values from JS to DB.
Refer this article, Call Server Side Code using ASP.NET AJAX and jQuery AJAX[^].

And about the infinite loop for textbox, I've got a question: When this loop would stop ? (probably never unless you have some conditions but I don't see any) Think on it ;)

-KR


这篇关于如何在c#中向sql server添加元素数组到数据库中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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