sabuj-matrixnmedia
-
1/3/2012 4:10:24 AM
Kentoco CMS v6 error
Hello,
There are lot of changed between Kentico CMS v5 and Kentico v6. Also v5 code not run in v6 kentico server.
Example we userd this code in our kentico web part v5. GeneralConnection genConn = InitDbConn(); object[,] lParameters = new object[5, 3]; lParameters[0, 0] = "@ParamFromLoc"; lParameters[0, 1] = locName; lParameters[1, 0] = "@ParamFromLat"; lParameters[1, 1] = latPos; lParameters[2, 0] = "@ParamFromLon"; lParameters[2, 1] = lonPos; lParameters[3, 0] = "@ParamMaxDist"; lParameters[3, 1] = redius; lParameters[4, 0] = "@MarketingLevel"; lParameters[4, 1] = passVal;
And it gives this error..
[Error loading the WebPart 'HotelsDisplay'] d:\home\Default\airportcodesdatabase.com\htdocs\CMSWebParts\MyWebParts\cmshotelsdisplay.ascx.cs(1098): error CS1502: The best overloaded method match for 'CMS.DataEngine.GeneralConnection.ExecuteQuery(string, CMS.SettingsProvider.QueryDataParameters, string, string)' has some invalid arguments
The we used this for Kentico CMS v6 and it fixed the error.
QueryDataParameters lParameters = new QueryDataParameters(); lParameters.Add("@ParamFromLoc", locName); lParameters.Add("@ParamFromLat", latPos); lParameters.Add("@ParamFromLon", lonPos); lParameters.Add("@ParamMaxDist", redius); lParameters.Add("@MarketingLevel", passVal);
Also it don’t work this kind of Connection string init.
UserInfo admin = UserInfoProvider.GetUserInfo("administrator"); GeneralConnection genConn = ConnectionHelper.GetConnection(HotelCMSLibFunction.ConnectionString(), admin.UserID);
And this type of Connection string initialization not works too...
SqlDataSource1.ConnectionString = ConnectionHelper.GetConnection().ConnectionString;
|