Answered by:
The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine.

Question
-
User1017598604 posted
Hi all
Ok having worked around my initial problem with the help of a ASP.NET member on my local development machine (posting http://forums.asp.net/t/1388042.aspx)
I managed to get the website up and running locally. I have now uploaded the website to the proper web server that my client provided through a local ISP.I have no idea of what the remote server is in terms of its PC spec and O/S (I have mailed them for an answer to this) but I do know that it wont have VS installed on it so the above solutions I used for my local machine wont work.
Basically is the cause of the error "The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine." down to the same thing ?
Strangely the search drop downs I have access the same Access database 100%. The drop downs change according to a previous drop down selection. The items in the drop downs are drawn from the database through select statements. Then when the search button is clicked is when the error occurs. The error occurs on line 269.
You can view the actual error itself by going to http://www.shooters-market.co.za/ a selection on the left then click search.
1 using System; 2 using System.Data; 3 using System.Configuration; 4 using System.Collections; 5 using System.Web; 6 using System.Web.Security; 7 using System.Web.UI; 8 using System.Web.UI.WebControls; 9 using System.Web.UI.WebControls.WebParts; 10 using System.Web.UI.HtmlControls; 11 12 using System.Data.SqlClient; 13 using System.Data.OleDb; 14 15 using shooters; 16 17 /// <summary> 18 /// 1. This code has been written to use one of two databases, access or sql. As determine 19 /// and specified within the web.config file. 20 /// <add key="DB_TYPE" value="ACCESS"/> = Sets the database type used to Access 21 /// <add key="DB_TYPE" value="SQL"/> = Sets the database type used to Sql 22 /// 23 /// The correct connection string must also be selected as determined by the web.config setting 24 /// of <add key="CURRENTDB" value="GDSDEV_ACCESS"/> for example. 25 /// </summary> 26 27 public partial class _Default : System.Web.UI.Page 28 { 29 private string cStr; 30 private string QS_Catagory; 31 private string QS_SubCategory; 32 private string QS_Manu; 33 private string sqlSelect; 34 private string itemTemplateHtml; 35 private string searchResultHtml; 36 37 private string dbType; 38 39 private string pageCat = ""; 40 private string pageSubCat = ""; 41 private string pageManu = ""; 42 43 protected void Page_Init(object sender, EventArgs e) 44 { 45 46 } 47 48 protected void Page_Load(object sender, EventArgs e) 49 { 50 dbType = Utilities.getDatabaseType(); 51 cStr = Utilities.getConnectionString(); 52 53 QS_Catagory = Request.QueryString["c"].ToString(); 54 QS_SubCategory = Request.QueryString["s"].ToString(); 55 QS_Manu = Request.QueryString["m"].ToString(); 56 57 string Stock_Id = ""; 58 string Catagory = ""; 59 string Sub_Catagory = ""; 60 string Make = ""; 61 string Model = ""; 62 string Caliber = ""; 63 string Description = ""; 64 string Suppliers_code = ""; 65 string FileName = ""; 66 string Retail_Price = ""; 67 string Discount_Price = ""; 68 69 string currentItemHtml = ""; 70 searchResultHtml = ""; 71 72 SqlConnection oConn; 73 SqlCommand oComm; 74 SqlDataReader oSDR; 75 76 OleDbConnection oledbConn; 77 OleDbCommand oledbComm; 78 OleDbDataReader oledbSDR; 79 80 DropDownList ddl_cat = (DropDownList)SearchControl.FindControl("search_Cat"); 81 DropDownList ddl_subcat = (DropDownList)SearchControl.FindControl("search_SubCat"); 82 DropDownList ddl_manu = (DropDownList)SearchControl.FindControl("search_Manu"); 83 84 if (!IsPostBack) 85 { 86 87 } 88 89 if (QS_Catagory.Length >= 1 && QS_SubCategory.Length >= 1 && QS_Manu.Length >= 1) 90 { 91 sqlSelect = "SELECT * FROM [SM Stock Table] WHERE Catagory = '" + QS_Catagory + "' AND [Sub Catagory] = '" + QS_SubCategory + "' AND [Make] = '" + QS_Manu + "'"; 92 header.Text = QS_Catagory + " - " + QS_SubCategory + " - " + QS_Manu; 93 } 94 95 if (QS_Catagory.Length >= 1 && QS_SubCategory.Length >= 1 && QS_Manu.Length <= 0) 96 { 97 sqlSelect = "SELECT * FROM [SM Stock Table] WHERE Catagory = '" + QS_Catagory + "' AND [Sub Catagory] = '" + QS_SubCategory + "'"; 98 header.Text = QS_Catagory + " - " + QS_SubCategory; 99 } 100 101 if (QS_Catagory.Length >= 1 && QS_SubCategory.Length <= 0 && QS_Manu.Length <= 0) 102 { 103 sqlSelect = "SELECT * FROM [SM Stock Table] WHERE Catagory = '" + QS_Catagory + "'"; 104 header.Text = QS_Catagory; 105 } 106 107 if (QS_Catagory.Length <= 0 && QS_SubCategory.Length <= 0 && QS_Manu.Length <= 0) 108 { 109 sqlSelect = "SELECT * FROM [SM Stock Table]"; 110 header.Text = "Show all products"; 111 } 112 113 itemTemplateHtml = ItemTemplateUtils.GetItemTemplateByFileName(Server.MapPath("tmp_ItemTemplate.tmp")); 114 115 116 117 118 if (dbType == "SQL") 119 { 120 oConn = new SqlConnection(cStr); 121 oComm = new SqlCommand(); 122 oConn.Open(); 123 124 oComm.CommandType = CommandType.Text; 125 oComm.Connection = oConn; 126 oComm.CommandText = sqlSelect; 127 128 oSDR = oComm.ExecuteReader(); 129 130 while (oSDR.Read()) 131 { 132 searchResultHtml = searchResultHtml + "<P>"; 133 134 Stock_Id = ""; 135 Catagory = ""; 136 Sub_Catagory = ""; 137 Make = ""; 138 Model = ""; 139 Caliber = ""; 140 Description = ""; 141 Suppliers_code = ""; 142 FileName = ""; 143 Retail_Price = ""; 144 Discount_Price = ""; 145 146 Stock_Id = oSDR.GetValue(0).ToString(); 147 Catagory = oSDR.GetValue(1).ToString(); 148 Sub_Catagory = oSDR.GetValue(2).ToString(); 149 Make = oSDR.GetValue(3).ToString(); 150 Model = oSDR.GetValue(4).ToString(); 151 Caliber = oSDR.GetValue(5).ToString(); 152 Description = oSDR.GetValue(6).ToString(); 153 Suppliers_code = oSDR.GetValue(7).ToString(); 154 FileName = oSDR.GetValue(8).ToString(); 155 Retail_Price = oSDR.GetValue(9).ToString(); 156 Discount_Price = oSDR.GetValue(10).ToString(); 157 158 currentItemHtml = itemTemplateHtml; 159 160 if (Stock_Id.Length >= 1) 161 { 162 currentItemHtml = currentItemHtml.Replace("{{Stock Id}}", Stock_Id); 163 } 164 else 165 { 166 currentItemHtml.Replace("{{Stock Id}}", ""); 167 } 168 169 if (Catagory.Length >= 1) 170 { 171 currentItemHtml = currentItemHtml.Replace("{{Catagory}}", Catagory); 172 } 173 else 174 { 175 currentItemHtml.Replace("{{Catagory}}", ""); 176 } 177 178 if (Sub_Catagory.Length >= 1) 179 { 180 currentItemHtml = currentItemHtml.Replace("{{Sub Catagory}}", Sub_Catagory); 181 } 182 else 183 { 184 currentItemHtml.Replace("{{Sub Catagory}}", ""); 185 } 186 187 if (Make.Length >= 1) 188 { 189 currentItemHtml = currentItemHtml.Replace("{{Make}}", Make); 190 } 191 else 192 { 193 currentItemHtml.Replace("{{Make}}", ""); 194 } 195 196 if (Model.Length >= 1) 197 { 198 currentItemHtml = currentItemHtml.Replace("{{Model}}", Model); 199 } 200 else 201 { 202 currentItemHtml.Replace("{{Model}}", ""); 203 } 204 205 if (Caliber.Length >= 1) 206 { 207 currentItemHtml = currentItemHtml.Replace("{{Caliber}}", Caliber); 208 } 209 else 210 { 211 currentItemHtml.Replace("{{Caliber}}", ""); 212 } 213 214 if (Description.Length >= 1) 215 { 216 currentItemHtml = currentItemHtml.Replace("{{Description}}", Description); 217 } 218 else 219 { 220 currentItemHtml.Replace("{{Description}}", ""); 221 } 222 223 if (Suppliers_code.Length >= 1) 224 { 225 currentItemHtml = currentItemHtml.Replace("{{Suppliers code}}", Suppliers_code); 226 } 227 else 228 { 229 currentItemHtml.Replace("{{Suppliers code}}", ""); 230 } 231 232 if (Retail_Price.Length >= 1) 233 { 234 currentItemHtml = currentItemHtml.Replace("{{Retail Price}}", Retail_Price); 235 } 236 else 237 { 238 currentItemHtml.Replace("{{Retail Price}}", ""); 239 } 240 241 if (Discount_Price.Length >= 1) 242 { 243 currentItemHtml = currentItemHtml.Replace("{{Discount Price}}", Discount_Price); 244 } 245 else 246 { 247 currentItemHtml.Replace("{{Discount Price}}", ""); 248 } 249 250 if ((FileName.Length == 0) || (FileName == "") || (FileName == null) || (FileName == "n/a") || (FileName == "none")) 251 { 252 currentItemHtml = currentItemHtml.Replace("{{FileName}}", ""); 253 } 254 else 255 { 256 currentItemHtml = currentItemHtml.Replace("{{FileName}}", "<IMG src='/images/products/" + FileName + "'>"); 257 } 258 259 searchResultHtml = searchResultHtml + currentItemHtml; 260 261 searchResultHtml += "</P>"; 262 263 } 264 oSDR.Close(); 265 oConn.Close(); 266 }else{ 267 oledbConn = new OleDbConnection(cStr); 268 oledbComm = new OleDbCommand(); 269 oledbConn.Open(); 270 271 oledbComm.CommandType = CommandType.Text; 272 oledbComm.Connection = oledbConn; 273 oledbComm.CommandText = sqlSelect; 274 275 oledbSDR = oledbComm.ExecuteReader(); 276 277 while (oledbSDR.Read()) 278 { 279 searchResultHtml = searchResultHtml + "<P>"; 280 281 Stock_Id = ""; 282 Catagory = ""; 283 Sub_Catagory = ""; 284 Make = ""; 285 Model = ""; 286 Caliber = ""; 287 Description = ""; 288 Suppliers_code = ""; 289 FileName = ""; 290 Retail_Price = ""; 291 Discount_Price = ""; 292 293 Stock_Id = oledbSDR.GetValue(0).ToString(); 294 Catagory = oledbSDR.GetValue(1).ToString(); 295 Sub_Catagory = oledbSDR.GetValue(2).ToString(); 296 Make = oledbSDR.GetValue(3).ToString(); 297 Model = oledbSDR.GetValue(4).ToString(); 298 Caliber = oledbSDR.GetValue(5).ToString(); 299 Description = oledbSDR.GetValue(6).ToString(); 300 Suppliers_code = oledbSDR.GetValue(7).ToString(); 301 FileName = oledbSDR.GetValue(8).ToString(); 302 Retail_Price = oledbSDR.GetValue(9).ToString(); 303 Discount_Price = oledbSDR.GetValue(10).ToString(); 304 305 currentItemHtml = itemTemplateHtml; 306 307 if (Stock_Id.Length >= 1) 308 { 309 currentItemHtml = currentItemHtml.Replace("{{Stock Id}}", Stock_Id); 310 } 311 else 312 { 313 currentItemHtml.Replace("{{Stock Id}}", ""); 314 } 315 316 if (Catagory.Length >= 1) 317 { 318 currentItemHtml = currentItemHtml.Replace("{{Catagory}}", Catagory); 319 } 320 else 321 { 322 currentItemHtml.Replace("{{Catagory}}", ""); 323 } 324 325 if (Sub_Catagory.Length >= 1) 326 { 327 currentItemHtml = currentItemHtml.Replace("{{Sub Catagory}}", Sub_Catagory); 328 } 329 else 330 { 331 currentItemHtml.Replace("{{Sub Catagory}}", ""); 332 } 333 334 if (Make.Length >= 1) 335 { 336 currentItemHtml = currentItemHtml.Replace("{{Make}}", Make); 337 } 338 else 339 { 340 currentItemHtml.Replace("{{Make}}", ""); 341 } 342 343 if (Model.Length >= 1) 344 { 345 currentItemHtml = currentItemHtml.Replace("{{Model}}", Model); 346 } 347 else 348 { 349 currentItemHtml.Replace("{{Model}}", ""); 350 } 351 352 if (Caliber.Length >= 1) 353 { 354 currentItemHtml = currentItemHtml.Replace("{{Caliber}}", Caliber); 355 } 356 else 357 { 358 currentItemHtml.Replace("{{Caliber}}", ""); 359 } 360 361 if (Description.Length >= 1) 362 { 363 currentItemHtml = currentItemHtml.Replace("{{Description}}", Description); 364 } 365 else 366 { 367 currentItemHtml.Replace("{{Description}}", ""); 368 } 369 370 if (Suppliers_code.Length >= 1) 371 { 372 currentItemHtml = currentItemHtml.Replace("{{Suppliers code}}", Suppliers_code); 373 } 374 else 375 { 376 currentItemHtml.Replace("{{Suppliers code}}", ""); 377 } 378 379 if (Retail_Price.Length >= 1) 380 { 381 currentItemHtml = currentItemHtml.Replace("{{Retail Price}}", Retail_Price); 382 } 383 else 384 { 385 currentItemHtml.Replace("{{Retail Price}}", ""); 386 } 387 388 if (Discount_Price.Length >= 1) 389 { 390 currentItemHtml = currentItemHtml.Replace("{{Discount Price}}", Discount_Price); 391 } 392 else 393 { 394 currentItemHtml.Replace("{{Discount Price}}", ""); 395 } 396 397 if ((FileName.Length == 0) || (FileName == "") || (FileName == null) || (FileName == "n/a") || (FileName == "none")) 398 { 399 currentItemHtml = currentItemHtml.Replace("{{FileName}}", ""); 400 } 401 else 402 { 403 currentItemHtml = currentItemHtml.Replace("{{FileName}}", "<IMG src='/images/products/" + FileName + "'>"); 404 } 405 406 searchResultHtml = searchResultHtml + currentItemHtml; 407 408 searchResultHtml += "</P>"; 409 410 } 411 oledbSDR.Close(); 412 oledbConn.Close(); 413 } 414 415 416 417 418 419 420 421 searchResult.Text = searchResultHtml; 422 423 } 424 } 425
Thursday, March 5, 2009 3:53 AM
Answers
-
User-1171043462 posted
Strangely the search drop downs I have access the same Access database 100%. The drop downs change according to a previous drop down selection. The items in the drop downs are drawn from the database through select statements. Then when the search button is clicked is when the error occurs. The error occurs on line 269.
You can view the actual error itself by going to http://www.shooters-market.co.za/ a selection on the left then click search.
I am not getting Error I did search with different items around 5-6 times
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Thursday, March 5, 2009 4:57 AM