473,848 Members | 1,821 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem with Multiple-step OLE DB operation generated errors

14 New Member
OK, like the title says my error is
Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.
I have looked into this a lot, but have not been able to find a solution to it.
Expand|Select|Wrap|Line Numbers
  1. <%@ Page Language="c#" runat="server" debug="true" %>
  2. <%@ Import Namespace="System.Data" %>
  3. <%@ Import Namespace="System.Data.OleDb" %>
  4. <script runat="server">
  5. OleDbConnection conn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=************;Initial Catalog=******;User Id=******;Password='********';;"); 
  6. protected void Page_Load(Object Src, EventArgs E)
  7. {
  8. if (!IsPostBack)
  9. if (Session["msg"] == null)
  10. {
  11. memberLogin.Visible = true;
  12. shoppingCart.Visible = false;
  13. rptMain.Visible = true;
  14. rptDetail.Visible = false;
  15. string loadSQL = "Select * From product";
  16. search(loadSQL);
  17. GetCats();
  18. }
  19. if (Session["msg"] == "Member Created!")
  20. {
  21. memberLogin.Visible = true;
  22. shoppingCart.Visible = false;
  23. lbUser.Text = "Login to your new account";
  24. string loadSQL = "Select * From product";
  25. search(loadSQL);
  26. GetCats();
  27. }
  28. if (Session["msg"] == "Please continue shopping")
  29. {
  30. memberLogin.Visible = false;
  31. shoppingCart.Visible = true;
  32. string loadSQL = "Select * From product";
  33. search(loadSQL);
  34. GetCats();
  35. GetCart(Session.SessionID);
  36. lbUser.Text = "Please continue shopping!";
  37. if (Session["msg"] == "Your Profile has been updated!")
  38. {
  39. memberLogin.Visible = false;
  40. shoppingCart.Visible = true;
  41. string loadSQL = "Select * From product";
  42. search(loadSQL);
  43. GetCats();
  44. GetCart(Session.SessionID);
  45. lbUser.Text = "Your profile has been updated. The changes will take effect the next time you log in.";
  46. if (Session["msg"] == "You have not updated your account!")
  47. {
  48. memberLogin.Visible = false;
  49. shoppingCart.Visible = true;
  50. string loadSQL = "Select * From product";
  51. search(loadSQL);
  52. GetCats();
  53. GetCart(Session.SessionID);
  54. lbUser.Text = "You have not updated your account!";
  55. }
  56. }
  57. }
  58. public void search(string sSQL)
  59. rptDetail.Visible = false;
  60. rptMain.Visible = true;
  61. OleDbCommand CmdSch = new OleDbCommand(sSQL, conn);
  62. conn.Open();
  63. rptMain.DataSource = CmdSch.ExecuteReader();
  64. rptMain.DataBind();
  65. conn.Close();
  66. }
  67. public void logout(object s, EventArgs e)
  68. {
  69. string loadSQL = "Select * From product";
  70. search(loadSQL);
  71. memberLogin.Visible = true;
  72. shoppingCart.Visible = false;
  73. rptMain.Visible = true;
  74. rptDetail.Visible = false;
  75. GetCats();
  76. Session.Contents.RemoveAll();
  77. lbUser.Text = "You have successfully logged out.";
  78. }
  79. public void btLogin_Click(Object s, EventArgs e)
  80. {
  81. string logSQL = "Select cust_id, username, pword, fname, lname from Customer where username='" + tbUser.Text + "' and pword = '" + tbPass.Text + "'";
  82. OleDbDataAdapter logDA = new OleDbDataAdapter(logSQL, conn);
  83. string msg1 = "Record not found";
  84. DataSet logDS = new DataSet();
  85. logDA.Fill(logDS, "customer");
  86. int numRecs = logDS.Tables["customer"].Rows.Count;
  87. if(numRecs > 0)
  88. {
  89. foreach(DataRow logRow in logDS.Tables["customer"].Rows)
  90. {
  91. Session["customer"] = logRow[3].ToString() + " " + logRow[4].ToString();
  92. Session["cust_id"] = logRow[0].ToString();
  93. }
  94.  
  95. lbUser.Text = "Welcome back, " + Session["customer"];
  96. memberLogin.Visible = false;
  97. shoppingCart.Visible = true;
  98. }
  99. else
  100. {
  101. lbUser.Text = msg1 + " - Please try your login again";
  102. }
  103. }
  104. public void cmdCheck(object sender, RepeaterCommandEventArgs e)
  105. {
  106. if (e.CommandName == "Details")
  107. {
  108. LinkButton lbtnSelected = new LinkButton();
  109. lbtnSelected.Text = ((LinkButton)e.CommandSource).Text;
  110. string sProduct = lbtnSelected.Text;
  111. string SQL8 = "Select * From Product where p_name = '" + lbtnSelected.Text + "'";
  112. showDetails(sProduct, SQL8);
  113. }
  114. if (e.CommandName == "AddToCart")
  115. {
  116. Label lbSelected = new Label();
  117. lbSelected = (Label) e.Item.FindControl("lbProduct_ID");
  118. Label priceSelected = new Label();
  119. priceSelected = (Label) e.Item.FindControl("lbPrice");
  120. string sPrice = priceSelected.Text;
  121. double dPrice;
  122. int at = sPrice.IndexOf("$");
  123. if (at == 0)
  124. {
  125.     dPrice = Convert.ToDouble(sPrice.Remove(at, 1));
  126. }
  127. else
  128. {
  129.     dPrice = Convert.ToDouble(sPrice);
  130. }
  131. string sProdID = lbSelected.Text;
  132. int prod_id = Convert.ToInt32(sProdID);
  133. string sProduct = e.CommandArgument.ToString();
  134. string SQL9 = "SELECT * FROM product WHERE product_id = '" + prod_id + "'";
  135. AddToCart(prod_id, dPrice, sProduct, SQL9);
  136. }
  137. }
  138. public void showDetails(string sProduct, string sSQL)
  139. {
  140. lbHeader.Text = "Details For: " + sProduct;
  141. OleDbCommand cmd8 = new OleDbCommand(sSQL, conn);
  142. conn.Open();
  143. rptDetail.DataSource = cmd8.ExecuteReader();
  144. rptDetail.DataBind();
  145. conn.Close();
  146. rptMain.Visible = false;
  147. rptDetail.Visible = true;
  148.  
  149. }
  150. void AddToCart(int product_id, double price, string p_name, string sSQL1)
  151. {
  152. if (Session["cust_id"] == null)
  153. {
  154. lbUser.Text = "<b>YOU MUST LOG IN BEFORE ORDERING!!</b>";
  155. lbUser.Visible = true;
  156. }
  157. else
  158. {
  159. string checkCart = "SELECT prod_id FROM Items WHERE product_id = prod_id";
  160. OleDbDataAdapter logDACart = new OleDbDataAdapter(checkCart, conn);
  161. DataSet logDSCart = new DataSet();
  162. logDACart.Fill(logDSCart, "Items");
  163. int numRecsCart = logDSCart.Tables["Items"].Rows.Count;
  164. if(numRecsCart > 0)
  165. {
  166. lbUser.Text = "You already have that item in your cart!";
  167. }
  168. else
  169. {
  170. string sessionNum = Session.SessionID;
  171. int cust_id = Convert.ToInt32(Session["cust_id"]);
  172. string SQLcart = "INSERT INTO Items (sess_ID, cust_id, prod_id, prod_name, prod_price) VALUES ('" + sessionNum + "', " + cust_id + ", " + product_id + ", '" + p_name + "', " + price + ")";
  173. OleDbCommand insCart = new OleDbCommand(SQLcart, conn);
  174. conn.Open();
  175. insCart.ExecuteNonQuery();
  176. conn.Close();
  177. GetCart(sessionNum);
  178. }
  179. }
  180. }
  181. public void GetCart(string sessNum)
  182. {
  183. string SQLgetCart = "SELECT * FROM items WHERE cust_id = " + Session["cust_id"] + " AND sess_ID = '" + sessNum + "'";
  184. OleDbCommand cmdGetCart = new OleDbCommand(SQLgetCart, conn);
  185. conn.Open();
  186. dlsCart.DataSource = cmdGetCart.ExecuteReader();
  187. dlsCart.DataBind();
  188. conn.Close();
  189. lbCart.Text = "Your Selections:";
  190. btClearCart.Visible = true;
  191. lnkViewCart.Visible = true;
  192. lbUser.Text = "Cart available for " + Session["customer"];
  193. }
  194. void ClearCartClick(object s, EventArgs e)
  195. {
  196. clearcart();
  197. }
  198. public void clearcart()
  199. {
  200. string SessNo = Session.SessionID;
  201. string SQLclearCart = "Delete FROM Items WHERE cust_id = " + Session["cust_id"] + " AND sess_ID = '" + SessNo + "'";
  202. OleDbCommand cmdClearCart = new OleDbCommand(SQLclearCart, conn);
  203. conn.Open();
  204. cmdClearCart.ExecuteNonQuery();
  205. conn.Close();
  206. GetCart(SessNo);
  207. lbCart.Text = "Your Cart is Empty";
  208. btClearCart.Visible = false;
  209. lnkViewCart.Visible = false;
  210. lbUser.Text = Session["customer"] + "'s Cart Emptied";
  211. }
  212. public void GetCats()
  213. {
  214. string catSQL = "Select * From lookCategory";
  215. OleDbCommand cmdCat = new OleDbCommand(catSQL, conn);
  216. conn.Open();
  217. ddlCat.DataSource = cmdCat.ExecuteReader();
  218. ddlCat.DataTextField = "Category";
  219. ddlCat.DataValueField = "Category";
  220. ddlCat.DataBind();
  221. ddlCat.Items.Insert(0, new ListItem("<-select->", ""));
  222. conn.Close();
  223. }
  224. public void buildCats(Object s, EventArgs e)
  225. {
  226. string SQL1 = "Select * From product Where Category = '" + ddlCat.SelectedItem.Value + "'";
  227. lbHeader.Text = "Search: Categories: " + ddlCat.SelectedItem.Value;
  228. search(SQL1);
  229. }
  230. </script>
  231.  
  232.  
And there is all of my code for the page I am working on. Didn't see a need to list all of the body/html code. The error points out these two lines:

if (Session["msg"] == null)
{
memberLogin.Vis ible = true;
shoppingCart.Vi sible = false;
rptMain.Visible = true;
rptDetail.Visib le = false;
string loadSQL = "Select * From product";
search(loadSQL) ; <<<<<<<<<<<<<<< <<<<<<
GetCats();

and

public void search(string sSQL)
{
rptDetail.Visib le = false;
rptMain.Visible = true;
OleDbCommand CmdSch = new OleDbCommand(sS QL, conn);
conn.Open(); <<<<<<<<<<<<<<< <<<<
rptMain.DataSou rce = CmdSch.ExecuteR eader();
rptMain.DataBin d();
conn.Close();
}


I've read around that I need to use a MySQL provider. So I download the provider, install it, then I get an error saying that the provider is not on the local machine, Ok whatever. I then read that I should have a OCDB connetor....sam e thing, doesn't show up on my local machine.

This came from a test server and it just now experiencing these problems. I'm thinking that it may just be the fact that I can't get the MySQL provider or the OCDB connector on my computer here, but I have downloaded/installed them both multiple times from different sources. There is only one record in the DB to test with, so its not a problem of mixed values somewhere.

I'm really having a problem here.

Any ideas and help would be much appreciated.
May 16 '07 #1
1 3077
dhyder
14 New Member
Sorry, forgot to mention that it is a MySQL database. Although its probably noticable this is in ASP.NET 1.1 with C#. I would prefer to keep the OleDb connection so I would not have to change everything around or rewrite anything. I have found a few other provider downloads to try and am in the process of that now.
May 17 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
1362
by: Rogue 9 | last post by:
I'm so sorry I'm using Pan v0.13.0 and it was doing screwy things when I tried to postfrom my sendlater folder.I re wrote the post but it went awry again and now I find multiple copies of my posts on the server. Please accept my apologies folks. Lol McBride -- Remove NOSPAM from my email address to use it,please.
4
2473
by: Michael C. Starkie | last post by:
Car is a class, with four wheel variables. SUV is a class with four wheel variables. Outback is a class that inherits from Car and SUV. How many wheel variables does Outback have? (In general, how does multiple inheritance work?)
11
17850
by: Georg Teichtmeister | last post by:
Hello! We are developing a math - library for realtime applications and want to use some given mathlibraries as base(ipp, MTL, .. ). Our library is a wrapper for those and you should be able to select the underlying library by template parameter. Therefore we split up our library in two namespaces: The first one defines namespace-global functions which call the baselibrary functions. These are templatefunctions which some
5
8335
by: zfeld | last post by:
I am serializing an object to XML and writing it to disk. whenever a change to my object occurs I call the save function to re-write to disk (see code below). I am monitoring the directory where this write is being done using a FileSystemWatcher. My problem is that my Watcher.Changed callback is always invoked twice.This is causing me to process the change twice (causing a performance hit). I am filtering to only be notified for...
9
2782
by: Graham | last post by:
I have been having some fun learning and using the new Controls and methods in .Net 2.0 which will make my life in the future easier and faster. Specifically the new databinding practises and wizards. But, I have found that trying to do something "outside the norm" adds a rather large level of complexity and/or data replication. Background I have been commissioned to create a web-based application for a client. It has a formsaunthentication...
7
2452
by: Chris | last post by:
Running into a problem on Windows. This code std::string randomStuff; std::getline(std::cin, randomStuff); works on unix, but on windows, it requires the user to hit the enter key *twice* before it continues past the getline. I tried changing the getline to std::getline(std::cin, randomStuff, '\n');
4
2991
by: jeff.maildump | last post by:
Hi, I've got multiple xmlhttprequests which are in a loop. So this is the loop I have so far, with the closure given to me in a previous post: //------------------------------------------------------------------------------------- for (i=0; i<data.length; i++) { httpRequest = false; httpRequest = new XMLHttpRequest(); httpRequest.onreadystatechange = function(index) {
6
2117
by: GregG | last post by:
Greetings, I've inherited a project which requires the use of multiple Access databases, each containing a dozen or so tables each. I need to perform queries which included relations and results from the contents of tables from separate databases. I've got the table adapters configured in the XSDs, connection strings in the web.config, and use data objects in the site's code, but for the life of me I cannot figure out how to...
2
1380
by: grandemahatma1 | last post by:
hallo, I'm pretty new to C and I'm having some problems while compiling multiple files; here what I do: I've got 3 files: 1.cpp , 2.cpp , INIT.h and these are the files: 1.cpp: #include <INIT.h>
4
16115
by: puneetsardana88 | last post by:
Hi I was implementing BFS and DFS So I have three class stack,queue,node and main class I have put Node class in Node.h #define SIZE_NEIGHBOURS 10 #define SIZE_GRAPH 100
0
9893
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9738
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11001
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10722
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10348
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9500
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
7069
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5919
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4137
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.