-
buddyguy


- Joined on 01-16-2008
- Posts 4
|
webservice and repeating table
Hey Everyone
I have a webservice and my code is attached below. this webservice takes repeating table data and puts it to a sql table. the issue is the webservice only submits the first line of the repeating table. can anyone tell me whats wrong?
Thanks in advance.
Arley
[ WebMethod]public int Insert2(
string empname,string FormNumber,
string itemid,string expensedate,
string origaddress,string origmunicipality,
string desaddress,string desmunicipality,
string purpose,int km,
string nonmileageexp,float expenseamt,
float ExpRate,string CompDate,
string ApprDate,string AppSup)
{ const string INSERT_COMMAND =
"insert into tblfromeforms(" +"empname,FormNumber,itemid,expensedate,origaddress," +
"origmunicipality,desaddress," +"desmunicipality,purpose,km,nonmileageexp,expenseamt,ExpRate,CompDate,ApprDate,AppSup)" +
"values (@empname,@FormNumber,@itemid,@expensedate,@origaddress," +"@origmunicipality,@desaddress," +"@desmunicipality,@purpose,@km,@nonmileageexp,@expenseamt,@ExpRate,@CompDate,@ApprDate,@AppSup)";
string strConn =System.Configuration.ConfigurationManager.ConnectionStrings["SQLTEMP_CONNECTION"].
ConnectionString;
try
{ using (SqlConnection cnn = new SqlConnection(strConn))
{
cnn.Open();
using (SqlCommand cmd = new SqlCommand())
{
cmd.Connection = cnn; cmd.CommandText = INSERT_COMMAND;
SqlParameterCollection ps = cmd.Parameters;ps.AddWithValue("@empname", empname);
ps.AddWithValue( "@FormNumber", FormNumber);ps.AddWithValue("@itemid", itemid);
ps.AddWithValue( "@expensedate", expensedate);ps.AddWithValue("@origaddress", origaddress);
ps.AddWithValue( "@origmunicipality", origmunicipality);ps.AddWithValue("@desaddress", desaddress);
ps.AddWithValue( "@desmunicipality", desmunicipality);ps.AddWithValue("@purpose", purpose);
ps.AddWithValue( "@km", km);ps.AddWithValue("@nonmileageexp", nonmileageexp);
ps.AddWithValue( "@expenseamt", expenseamt);ps.AddWithValue("@ExpRate", ExpRate);
ps.AddWithValue( "@compdate", CompDate);ps.AddWithValue("@apprdate", ApprDate);ps.AddWithValue("@appsup", AppSup);
return cmd.ExecuteNonQuery();
}
}
} catch (Exception ex)
{
System.Diagnostics. Trace.WriteLine(ex.ToString()); // Say _something_throw;
}
}
}
|
|