Jump to content

string issue


immad

Recommended Posts

hello,

 

this is my c# coding

string ICCIDMSISDN = "";            int LENICCID = 0;            foreach (GridViewRow grdRow in GridView1.Rows)            {                if (ICCIDMSISDN == "")                {                    ICCIDMSISDN +=  "'" + grdRow.Cells[0].Text + "'" ;                    LENICCID = grdRow.Cells[0].Text.Length;                }                else                {                    ICCIDMSISDN += "," + "'" + grdRow.Cells[0].Text + "'";                }            }            SqlConnection xConnection;            xConnection = MyConn.getCon();            {                using (SqlCommand com = new SqlCommand())                {                    xConnection.Open();                    com.Connection = xConnection;                    com.CommandType = CommandType.Text;                    if (LENICCID == 20)                    {                        com.CommandText = "update simcard set agentID ='" + DropDownList1.SelectedValue + "' where ICCID in(" + ICCIDMSISDN + ")";                    }                    else if (LENICCID == 19)                    {                        com.CommandText = " update simcard set agentID ='" + DropDownList1.SelectedValue + "' where substring(ICCID,1,LEN(ICCID)-1) in (" + ICCIDMSISDN + ")";                    }                    else                    {                        com.CommandText = "    update simcard set agentID ='" + DropDownList1.SelectedValue + "' where MSDSN in(" + ICCIDMSISDN + ")";                    }                    com.ExecuteNonQuery();                    xConnection.Close();                }            }

my update query update like this.

 

2,'89234184500041292711','89234184500041292737','89234184500041292836','',20
it gives me error
EVS_SP_UpdateSimAgent has too many arguments specified.
this is one parameter
'89234184500041292711','89234184500041292737','89234184500041292836'
but its give me above error
i want to update like this
2,'"89234184500041292711,89234184500041292737,89234184500041292836"','',20
thanks for the help

 

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...