如何创建数组字符串 [英] How to create array string

查看:132
本文介绍了如何创建数组字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请帮助我如何使用数组在asp.net类文件中创建此字符串:
更新表集名称= @名称,添加= @添加,日期= @日期
以及如何在asp.net页面中调用

Please help me how to create this string in asp.net class file using array:
Update table set name=@name,add=@add,date=@date
and how to call in asp.net page

推荐答案

在5分钟前查看我对相同主题的上一个问题的回答,并停止发布相同的问题-它是非常粗鲁.
See my answer to your previous question on the same topic 5 minutes ago, and stop posting the same question - it is very rude.


Rahul,

为什么要创建此字符串,是否要使用参数(参数化查询)?

您可以遍历数组并形成字符串,然后将其与"Update Table"查询结合起来.

就像您具有Parameters []一样,您可以遍历每个参数并形成字符串行"name = @ name,add = @ add,date = @ date ..."

问候
鲁西(Rushi)
Rahul,

Why you want to create this string, are you using parameters (parameterize query)?

You can loop through array and form the string, and join it with "Update Table" query.

Like you have Parameters[] then you can loop through each parameter and form string line "name=@name, add=@add, date=@date ..."

Regards
Rushi


尝试

Try

string query = "Update table set name=''"+ NameValue +"'',add= ''"+ addValue +"'',date= ''"+ dateValue +"''";



如果数据类型是text或varchar或datetime,请使用单引号将其删除



If the datatype is text or varchar or datetime use single quote else remove them


这篇关于如何创建数组字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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