immad Posted February 28, 2014 Share Posted February 28, 2014 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 More sharing options...
justsomeguy Posted February 28, 2014 Share Posted February 28, 2014 What part are you having problems with? Which variable has that value in it? The error message makes it sounds like you're executing a stored procedure called EVS_SP_UpdateSimAgent, but I don't see that in your code. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now