2013-04-29 139 views
0

我一遍又一遍地检查了我的代码。但我似乎无法找到这个错误发生的地方。 这里是我的代码:输入字符串格式不正确

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(); 
} 

请帮助我。

+0

前什么是埃罗并在其中直插U得到它... – 2013-04-29 04:40:44

+0

输入字符串的不正确的format..this是我不断收到错误.. .i得到“字符串merUpdate”行中的错误... @voo – aianLee 2013-04-29 04:44:56

+0

输入字符串的格式不正确。这是我继续得到的错误...我在“字符串merUpdate”行中得到错误... @amit Singh – aianLee 2013-04-29 05:10:47

回答

0

hnumber缺少@在它

+0

我仍然得到同样的错误... @Seckin Tozlu – aianLee 2013-04-29 04:50:54

+0

你在查询中定义@id,但你没有通过任何东西 – 2013-04-29 04:53:52

+0

我包括@ id ..但我仍然得到相同的错误...如果这有帮助,它不会当我调试它时去数据层... – aianLee 2013-04-29 05:04:05