输入字符串格式不正确
问题描述:
我一遍又一遍地检查了我的代码。但我似乎无法找到这个错误发生的地方。 这里是我的代码:输入字符串格式不正确
public static string MerchantUpdate(string firstN, string lastN, int type, int reseller, string CoName, string site, int industry, bool isact, bool isdel, string houseNO, string street, string town, string city, string state, string zipcode, int countryID, string telephone, string fax, string userN, string emailA, string secQ, string secA, decimal set, decimal month, decimal dep, decimal with, decimal eTrans, decimal acct, DateTime created)
{
string retmerUpdate = "";
string merUpdate = "UPDATE MerchantMaster SET FirstName = @fname, LastName = @lname, MerchantTypeID = @typeID, ResellerMasterID = @resellerID, "
+ "CompanyName = @CoName, Url = @url, IndustryID = @IndustryID, IsActive = @isact, IsDeleted = @isdel, HouseNo = hnumber, "
+ "StreetAddress = @address, Town = @townAD, City = @cityAD, State = @stateAD, ZipCode = @zipC, CountryID = @countryID, "
+ "TelephoneNo = @teleNo, FaxNo = @faxNo, UserName = @uName, EmailAdr = @eAD, SecurityQ = @secQ, SecurityA = @secA, Setup = @set, "
+ "Monthly = @month, Deposit = @dep, Withdraw = @with, EmailTransfer = @eTrans, AccTransfer = @acct, DateCreated = @created WHERE id = @id";
string[] param = { "@fname", "@lname", "@typeID", "@resellerID", "@CoName", "@url", "@IndustryID", "@isact", "@isdel", "@hnumber", "@address", "@townAD", "@cityAD", "@stateAD", "@zipC", "@countryID", "@teleNo", "@faxNo", "@uName", "@eAD", "@secQ", "@secA", "@set", "@month", "@dep", "@with", "@eTrans", "@acct", "@created" };
object[] paramVal = { firstN, lastN, type, reseller, CoName, site, industry, isact, isdel, houseNO, street, town, city, state, zipcode, countryID, telephone, fax, userN, emailA, secQ, secA, set, month, dep, with, eTrans, acct, created};
try
{
ClassDBQuery.ExecNonQuery(merUpdate, param, paramVal);
retmerUpdate = "success";
}
catch (Exception ex)
{
retmerUpdate = ex.Message;
}
return retmerUpdate;
}
这背后是我的代码:
using (SqlConnection connectString = new SqlConnection(GetConnectString()))
//update merchant master
try
{
int idses = Convert.ToInt32(Session["ID"].ToString());
string merUpdate = ClassMerchant.MerchantUpdate(fName.Text, lName.Text, Convert.ToInt32(ddlT.SelectedValue), Convert.ToInt32(ddlR.SelectedValue), CompName.Text, website.Text, Convert.ToInt32(ddlI.SelectedValue), true, false, houseN.Text, streetAD.Text, townAD.Text, cityAD.Text, stateAD.Text, zipC.Text, Convert.ToInt32(ddlC.SelectedValue), teleNumb.Text, faxNumb.Text, userN.Text, Eaddress.Text, secQuest.Text, secAns.Text, Convert.ToDecimal(set.Text), Convert.ToDecimal(month.Text), Convert.ToDecimal(dep.Text), Convert.ToDecimal(with.Text), Convert.ToDecimal(etrans.Text), Convert.ToDecimal(aTrans.Text), DateTime.Now);
}
catch (Exception ex)
{
lblMessage.Text = ex.Message;
}
finally
{
if (connectString.State == System.Data.ConnectionState.Open)
connectString.Close();
}
请帮助我。
前什么是埃罗并在其中直插U得到它... – 2013-04-29 04:40:44
输入字符串的不正确的format..this是我不断收到错误.. .i得到“字符串merUpdate”行中的错误... @voo – aianLee 2013-04-29 04:44:56
输入字符串的格式不正确。这是我继续得到的错误...我在“字符串merUpdate”行中得到错误... @amit Singh – aianLee 2013-04-29 05:10:47