如何使用Split方法查询字符串值 [英] How to use Split method for Query String value

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

问题描述

string s = Convert.ToString(Request["client_id"]);





例如< b> Client_id 值是venkat,kumar,9494949494,20000,hyderabad;



我只想显示此页面中的数据并保存到数据库。



For example Client_id value is "venkat,kumar,9494949494,20000,hyderabad";

I just want to display the data in this Page and save it to the Database.

推荐答案

尝试

Try
string s = Convert.ToString(Request["client_id"]);
string[] parts = s.Split(',');
if (parts.Length >= 5)
   {
   string city = parts[4]  //Hyderabad in your example
   ...
   }


Hi
试试这样,可能对你有所帮助..







Hi Try like this, might help you..



string s = Convert.ToString(Request["client_id"]);
       string[] array = s.Split(',');
       //"venkat,kumar,9494949494,20000,hyderabad";
       if (array.Length == 5)
       {
           txtFirstName.Text = array[0];
           txtLastName.Text = array[1];
           txtPhone.Text = array[2];
           txtOthers.Text = array[3];
           txtCity.Text = array[4];

       }
       // for saving to database, read the modified values from the text boxes..


这篇关于如何使用Split方法查询字符串值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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