将数组存储到sql表中。 [英] store array into sql table.

查看:406
本文介绍了将数组存储到sql表中。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

hii,



i希望将字符串存储到我的sql表名中:句子和我的代码是:



hii,

i want to store string into my sql table name:Sentence and my code is:

protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e, GridViewRowEventArgs e1)
        {
            if (e.CommandName == "click")
            {
                int _myColumnIndex1 = 0;

                string text = e1.Row.Cells[_myColumnIndex1].Text;

                String[] sentences = Regex.Split(text, @"(?<=[.!?])\s+(?=\p{Lt})");


            }
        }

推荐答案

参考 - GridView.RowCommand事件 [ ^ ]。



你应该只传递两个事件参数而不是三个。将 RowIndex 存储在 CommandArgument 中,以便获取当前行。解释如下。

Refer - GridView.RowCommand Event[^].

You should pass only two Event Arguments not three. Store the RowIndex in CommandArgument, so that you can get the Current Row. Explained below.
void GridView1_RowCommand(Object sender, GridViewCommandEventArgs e)
{
    // Your logic
    // To get the Row, do the following
    if(e.CommandName == "click")
    {
        // Convert the row index stored in the CommandArgument
        // property to an Integer.
        int index = Convert.ToInt32(e.CommandArgument);

        // Retrieve the row that contains the button clicked 
        // by the user from the Rows collection.      
        GridViewRow row = GridView1.Rows[index];
     
        // Now get any column value from the "row" and do what u want to do.
    }
}


这篇关于将数组存储到sql表中。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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