473,626 Members | 3,292 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

UpdateBatch error When Delete Rows

This is my error :
<<impossible to approach the information on the line eliminated through the line>>

This is my code for updateBatch :

Private mSqlConn as sqlConnection

Public Function UpdateBatch(ByV al DTable As DataTable)
Dim mSqlDa As SqlDataAdapter
Dim MustCloseConnec tion As Boolean
Dim mDtable As DataTable
Dim mSqlCmd As New SqlCommand("SEL ECT * FROM TBL" & DTable.TableNam e, mSqlConn)
mSqlCmd.Command Type = CommandType.Tex t
mSqlDa = New SqlDataAdapter( mSqlCmd)
mSqlDa.FillSche ma(DTable, SchemaType.Sour ce)
Dim cmdBuilder As New SqlCommandBuild er(mSqlDa)
mSqlDa.InsertCo mmand = cmdBuilder.GetI nsertCommand
mSqlDa.DeleteCo mmand = cmdBuilder.GetD eleteCommand
mSqlDa.UpdateCo mmand = cmdBuilder.GetU pdateCommand
mSqlDa.Update(D Table)
mSqlDa.Dispose( )
mSqlCmd.Dispose ()
End Function

In my datatable i insert data and deletedata

Procedure Insert Data in a datatable :
'-----------------------------------------------------------
private sub InsertDtRow
DtRow = DTable .NewRow
DtRow("C1") = txt1.text -PRIMARY KEY
DtRow("C2") = txt2.text - PRIMARY KEY
DtRow("C3") = txt3.text
DtRow("C4") = txt4.text
DtRow("C5") =txt5.text
DTable .Rows.Add(DtRow )
DtRow = Nothing
end sub
'-------------------------------------------------------------

'Procedure delete data in a datatable
'----------------------------------------------------------------
private sub DeleteDtRow
Dim DtRow() As DataRow
DtRow = DTable .Select("C1=1 AND C2 = 2")

If DtRow.GetUpperB ound(0) <> -1 Then
DtRow(0).Delete ()
End If
end sub
'----------------------------------------------------------------

to the end I call UpdateBatch(DtT able) for update my table in db....
Nov 21 '05 #1
0 1045

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1193
by: Morten Gulbrandsen | last post by:
C:\mysql\bin>mysql -u elmasri -pnavathe company Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 29 to server version: 4.1.0-alpha-max-debug Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> select database(); +------------+ | database() | +------------+
0
3034
by: Morten Gulbrandsen | last post by:
mysql> USE company; Database changed mysql> mysql> DROP TABLE IF EXISTS EMPLOYEE; -------------- DROP TABLE IF EXISTS EMPLOYEE -------------- Query OK, 0 rows affected (0.00 sec)
1
469
by: Ellen K. | last post by:
Awhile back there was some discussion about ways of sending multiple rows of data to SQL Server. The ADO .UpdateBatch method was one of the possibilities mentioned, and Erland said he thought that probably once the data get to SQL Server they are probably actually inserted one row at a time. I just want to say that based on an experience I had a couple of days ago I am now sure that is the case. I was using ..UpdateBatch for something...
20
2020
by: MadCrazyNewbie | last post by:
Hey group, I keep getting the following error: "An unhandled exception of type 'System.IndexOutOfRangeException' occurred in system.data.dll Additional information: There is no row at position 1." on the following line of code:
1
2309
by: mivey4 | last post by:
Okay, The problem is that I have an Access Database that has the following fields: EmpID - Autonumber (PrimaryKey) AccountID - Text IssueReported - Memo DateOpened - Date/Time TimeOpened - Date/Time
0
3229
by: zfraile | last post by:
I'm getting this error from the JIT compiler at runtime, but only on my boss' machine, not my development machine. I believe the error is generated from a call to an Excel object, but I can't tell why or what specific action on the object is causing it. We both are running version 2.0 of the .net framework with Office 2003 installed, though I am running XP and she has Win2000. Also, I do not get this error when running another sub in...
4
2867
by: Steve | last post by:
hi all, i'm using DHTML to generate a dynamic table with adding removing and sorting rows the thing is after a row has been added at a position that i specify, if i try to delete it i get this error ! here's a chunk of code <script language='javascript' type='text/css' > function removeElement(divNum,arrayCode,elementId) {
4
10070
by: Szymon Dembek | last post by:
Hi Recently I did some DB2 and ODBC coding in Visual FoxPro. I bumped on a problem I cannot resolve. When I issue a delete statement that deletes no rows (no rows qualify for the WHERE conditions), DB2 raises SQL0100W warning with SQLSTATE=02000. The same happens when issuing an insert with select clause (insert into .... select from ...) when no rows are fetched by the select clause.
1
3587
patjones
by: patjones | last post by:
Hi: I am attempting to pull a backend table into a local recordset, make some changes to it, and commit the changes back to the table. I'm using an ADO recordset in Access 2007. The backend resides on a network drive while the front end is on my C: drive. My code is as follows: Dim rstBalances As New ADODB.Recordset Dim strSQL As String strSQL = "SELECT fldDateEffective, fldCurrentAL, fldCurrentSick, fldCurrentCT,...
0
8196
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
8701
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...
0
8637
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...
0
8502
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
7192
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
5571
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
4090
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4196
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1807
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.