473,827 Members | 2,861 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

weird datagrid..

46 New Member
Hi...
I very need yours help. I having a very weird problem. I want to consider the datagrid is empty or not, then if not empty, i want to total up the value. I using datagrid.text <> "" in my code. Overall i have 3datagrids. The program run smoothly at the first 2datagrids. But when reach to the third datagrids, It occurs error "data access error". What is the proint?? Please help me!
Thank you..

Expand|Select|Wrap|Line Numbers
  1. If datagrid1.Text <> "" Then
  2.             Adodc1.Recordset.MoveLast
  3.             Do While (Adodc1.Recordset.BOF <> True)
  4.                 total1 = total1 + Adodc1.Recordset.Fields("Hour")
  5.                 Adodc1.Recordset.MovePrevious
  6.             Loop
  7.                 txt1.Text = total1   'place in a text box
  8.         Else
  9.         End If
  10.  
  11.         If datagrid2.text <> "" Then
  12.             Adodc2.Recordset.MoveLast
  13.             Do While (Adodc2.Recordset.BOF <> True)
  14.                 total2 = total2 + Adodc2.Recordset.Fields("Hour")
  15.                 Adodc2.Recordset.MovePrevious
  16.             Loop
  17.                 txt2.Text = total2
  18.         Else
  19.         End If
  20.  
  21.         If datagrid3.Text <> "" Then
  22.             Adodc3.Recordset.MoveLast
  23.             Do While (Adodc3.Recordset.BOF <> True)
  24.                 total3 = total3 + Adodc3.Recordset.Fields("Hour")
  25.                 Adodc3.Recordset.MovePrevious
  26.             Loop
  27.                 txt3.Text = total3
  28.         Else
  29.         End If
  30.  
  31.  
May 30 '07 #1
0 987

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

Similar topics

2
1947
by: Shannon | last post by:
I am having a very strange issue with my asp.net application. I have created a datagrid which dynamically gets populated from a person choosing a value from a dropdown list and entering a quantity into a text box (a simple version of a shopping cart). When I run/debug the web page using the localhost in the page URL (http://localhost/mypage.aspx), the datagrid updates properly when a command button is clicked and all is well. However,...
0
1793
by: Greenwich Support | last post by:
Hi All, I have a very weird problem which is occurring with a VB.Net app and PostgreSQL 7.3.1. There is a form that has a standard .Net datagrid on it that contains some data from a table in PostgreSQL. Now, the datagrid has functionality to allow the developer to programmatically determine what changes (if any) that have been made to the grid by the user -- i.e. determine if any new rows has been added, any rows modified or deleted.
0
1659
by: shamila | last post by:
</asp:label><asp:datagrid id="DataGrid3" runat="server" cssclass="DataGrid" showfooter="True" onupdatecommand="DataGrid3_Update"ondeletecommand="DataGrid3_Delete" oneditcommand="DataGrid3_Edit" oncancelcommand="DataGrid3_Cancel" caption="Pricing Schedules" autogeneratecolumns="False" OnItemDataBound="ItemDataBoundEventHandler"> <alternatingitemstyle cssclass="DataGrid_AlternatingItemStyle" /> <columns> <asp:templatecolumn...
0
921
by: Alejandro Penate-Diaz | last post by:
I have two pages, each with one datagrid called "DataGrid1". Each DataGrid have a pushbutton implementing DeleteCommand, wich I am uing for a very different purpose tah actualy delete anything. From one pages' datagrid's delete button I redirect to page X with a certain query string, and from the other datagrid's delete button i redirect also to page X but with a different query string. For some reason both buttons are doing exaclty the...
1
1727
by: BW | last post by:
Hello, I am attempting to to take edited values from a datagrid control and update the underlying database. Problem is that some of the edited values don quite seem to make it to my update sub. My code is shown below. The values that are not appearing are Cell(4) - sCompletion and Cell(5) - sNote. The other values show up just fine. What am I missing here?
7
1098
by: scorpion53061 | last post by:
This exception occured while running in the development environment. The debugger didnt catch it though it appeared as a message box prompt........does anyone have insight on this? ************** Exception Text ************** System.NullReferenceException: Object reference not set to an instance of an object. at System.Windows.Forms.DataGrid.AddNewRow() at System.Windows.Forms.DataGridAddNewRow.OnEdit()
1
1061
by: Marco | last post by:
I'm having some a really weird issue with datagrids. Basically they work fine until you update the data while a cell is selected. If you do that then the old selected cell will remain on the screen and be on top of the new data. You can scroll the new data and the old cell will stay in the same position. You can even click on the old cell and move the cursor around in it. Does anyone know why this is happening?
1
893
by: Andy Sutorius via DotNetMonster.com | last post by:
I am getting this error when I compile a VS2005 web project: The name 'dgdANSI835' does not exist in the current context. This web project has been compiling fine. All of a sudden the code behind cant see the datagrid. The aspx has the datagrid in it. Just for kicks if I explicitly declare the datagrid in the class and compile the compiler says the datagrid already exists. Does anyone have a solution for this? -- Message posted via...
2
2658
by: Flack | last post by:
I have a DataGrid and a DataTable. When my form loads I create the DataTable with the appropriate columns and use it for the DataGrids.DataSource. Later on in my app, I alter the DataTable: dt.BeginLoadData(); for(int i = 0; i < _movesArrayList.Count; i++) { string columnValues = ((string)_movesArrayList).Split(COL_SEPARATOR); DataRow _moveRow = dt.NewRow();
0
9771
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
9631
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
10464
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10503
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
10183
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
9290
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...
1
7730
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6935
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
5768
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.