Update And Delete Records In Database (3 Tier)
I have problems with the updating and deleting of records in database. I'm using ObjectDataSource and the GridView to display the results in the database. Below is the codes for the update and delete (in the DAL (data access layer). BTW, I'm doing 3 tier architecture in VB.
'update the records accordingly in the database.
Public Function UpdateBooks(ByVal title As String, ByVal borrowDate As String, ByVal dueDate As String, ByVal NameBorrower As String, ByVal book_id As Integer) As Integer
Dim connectionString As String = My.Settings.dbConnection
I don't know why, but every time I try to update (by clicking on the update button), every thing is not updated, the page would refresh then the records still remain the same in the GridView. As for delete, when I clicked on the 'delete' button, the record is not deleted, it still remains there.
These are the codes in the (BLL (business logic layer)):
Public Function getUpdateBooks(ByVal title As String, ByVal borrowDate As String, ByVal dueDate As String, ByVal NameBorrower As String, ByVal book_id As Integer) As Integer
Dim ds As Integer = UserDA.UpdateBooks(title, borrowDate, dueDate, NameBorrower, book_id)
View 5 Replies (Posted: Jan 08, 2010 01:25 PM)
Related Forum Messages For vbnet category:
- Get Records Into Oracle Database Delete From DB And Update The Records?
- Add / Delete / Update Records In A Database
- Delete / Update And Searching Records In Database?
- Update And Delete Access Database Records?
- Update Database And Delete Records Via Datagridview
- Update And Delete Records From Access 2007 Database?
- Adding Records On Database - Creating Update And Delete Button?
- Application Which Can Create/update/delete/search Records Using Access Database?
- Asp.net - Update / Delete The Table Records In ASPNETDB.MDF In Single Update / Delete Query?
- .Net CommandBuilder Will Update, Insert, But Not Delete Records In SQL DB?
- Insert, Update & Delete Records In Datagridview?
- Add, Update, Delete Records From Oracle10gXE Using Text Boxes?
- Make Program That Input Data And Update, Delete Records From Access7?
- Add Records Using N-tier And Stored Procedure?
- Update, Append, Delete And Populate The Records To The Various Files Based On Two Distinct Fields, Column A & F?
- Cannot Delete New Records In Access Database
- Database - Delete Records From Ms Access?
- Delete Records From The Database If They Are At-least 3 Years Old?
- How To Delete Records In Access Database
- Edit,delete Records In Database Using Datagridveiw In .net?
- Insert/Delete Records In A MSSQL Database?
- Insert / Delete / Edit / Search Records And Connection With Database
- Save, Edit, And Delete Records In An Access Database Through Vb2008?
- Update Multiple Records In A Database?
- Update Records In SQL Server Database?
- How To Use A DataGridView Control To Add/Edit/Delete Records In A Simple Database Table
- How To Update Records On An Existing Access Database
- IDE :: Couldn't Update Records At Back End To Database
- Update Database Records Using Multiple Threads
- Update Records From 1 Text File Into 2 Different Sql Database?
-  Update Multiple Records To Sql Database?
- Edit / Update Records From Database Using Textbox By Linq To Sql?
- Edit/update Records From The Database Using Textbox By Linq To Sql?
- IDE :: Edit The Records In Datagridview And Update Changes Into Ms Access Database?
Add / Delete / Update Records In A Database
Ive created a form to add/delete/update records in a database ,but when i try and open the frm i get a NullReferenceExceptionUnhandled error, below is my code, i cannot for the life of me see where i've gone wrong, but maybe someone else can spot it?[code]
Posted: 19 November 2009
View 2 Replies!
Update Database And Delete Records Via Datagridview
I display my records using datagridview...I have also Save button which is intended to update any changes I make via the datagridview.I got this error whenever I type something in the address column "Update requires a valid UpdateCommand when passed DataRow collection with modified rows."[code]What code do I put so that whenever I highlight a row and click delete button or press delete key selected records will be deleted from datagridview as well as my database will be updated from any deletion?
Posted: Jun 23rd, 2010
View 8 Replies!
Update And Delete Records From Access 2007 Database?
How do I insert,update,and delete records in vb.net 2008 from a Access 2007 database?Really, I figured out how to add records - but I cannot delete or update records. Any pointers, website tutorials, etc?Also, I am binding the database table to Listbox which is working, but I need to update the listbox with deletion and update changes too...
Posted: November 03, 2008
View 3 Replies!
Adding Records On Database - Creating Update And Delete Button?
I have used this form to add new records on my database(ms access) in my database I have a column name 'ID' which is my primary key 'ID' is set as auto number. Now I am having a trouble on creating my update and delete button it's always saying "cannot be delete/update"
Here's my code on add, update and delete
Public Sub SaveRecord()
Dim dbConn As OleDbConnection
Dim dbInsert As New OleDbCommand
Dim str1, str2, str3, str4, str5, str6, str7, str8, str9 As String
Note my add is working perfectly fine. I just can find the error on my delete and update. Also I have used this to view it to my datagrid I don't know if its the right thing but it's working fine too.
'declared dbpath globally'
Dim dbPath As String = "Provider=Microsoft.Jet.Oledb.4.0; Data Source=../VG.mdb;Persist Security Info=False"
Another thing is how to code each textbox and combobox to bind it to my records so that when I click on the datagridview each column will be distributed on each respective textbox.
Posted: March 10, 2012
View 1 Replies!
Application Which Can Create/update/delete/search Records Using Access Database?
i have a simple application which can create/update/delete/search records using Access database. If i add a record, save it, then close the application and run it again and search for that record, it appears. However, when i write some code to my application, nothing to do with the search function, and i run the application the record is not found. For example i added a button to clear the textfields, and when i ran the application the records i have added earlier were not found.
Posted: Apr 24th, 2010
View 1 Replies!
.Net CommandBuilder Will Update, Insert, But Not Delete Records In SQL DB?
I have a datatable populated from an SQL Server 2008 database table. I created a DataAdapter with a commandbuilder to manage the updating, inserting, and deleting of records. The Updating and Inserting work as expected. However, Delete does not. The code runs through just fine without any errors. The number of records in the datatable after the row is deleted even reflects the deletion. The DataAdapter.Update works fine without any exceptions. But when checking the actual table in the SQL DB the deleted record is still there.Here are the parts of my code that deal with this table.
Posted: Feb, 2012
View 1 Replies!
Insert, Update & Delete Records In Datagridview?
I'm creating a project using Microsoft Access 2007 & Visual Basic 2008.I have two tables in my database, Staff and Training Attended. The Training Attended records of Staff are displayed in datagridview, residing in a different form from the Staff detailsWhat my program does is, it will display all of the Staff's list of Training Attended in datagridview once I click the button in Staff form. I've succeeded in retrieving the records. using bindingsource.filterThe problem is that I can't insert/update/delete records in the Training Attended datagridview. it keep giving me this error: Update requires a valid UpdateCommand when passed DataRow collection with modified rows.
Posted: Jun 28th, 2011
View 2 Replies!
Update, Append, Delete And Populate The Records To The Various Files Based On Two Distinct Fields, Column A & F?
Currently working on a project to automate the input based on the Summary file (xls format)
1. I want to be able to do the following: update, append, delete and populate the records to the various files based on two distinct fields, column A & F (see attached file).
2. Researched the process, requires knowing VB codes, are you familiar with this language? If so, how can I simplify the process? Please advise.
3. The files will reside on the SPP.
Posted: May 18, 2010
View 6 Replies!
Cannot Delete New Records In Access Database
I'm creating an application that adds and deletes records from a microsoft access database. The language I'm using is VB2008. I am importing the database through a wizard. I can add records and delete records, but I cannot delete a newly added record without closing the form first. When i reopen the form, I can delete the record. Here is how I have my database setup:
'Bind user info to the controls.
AUSERDataSet = New BulldogUsersDataSet
AUSERTableAdapter = New BulldogUsersDataSetTableAdapters.UsersTableAdapter
' Setup the binding source.
AUSERBindingSource = New BindingSource
View 5 Replies!
Database - Delete Records From Ms Access?
how to do it, but the tutorial is not applicable on the program that I wish to do. The tutorial tells you to add 4 navigation buttons so that you can navigate the database(first, last, back, and forward). Then an update and delete button. But if this is what I will do, it would take 10 years to navigate the database and update a record. Now, what I want to do is just for the user to input a unique ID and click search button(which I have already done). Then the update would be easier. How can I update or delete a record using this method?
Posted: Dec 21 09 at 0:48
View 1 Replies!
Delete Records From The Database If They Are At-least 3 Years Old?
I have a project that I am working on that requires me to delete records from the database if they are atleast 3 years old.I have something like this in DB2 SQL to get the date:
SELECT * FROM tableA
WHERE ADD_DATE < CHAR(CURRENT DATE-3 YEARS)
ADD_DATE is stored as Characters in my system, this is why I am converting I know it is also possible to get the date and format it in VB.net which is the language I am using to call the SQL statements.My question is whether it would be faster/better to get the date and perform the conversion inside the SELECT in SQL or would it be better to get the current date and convert it in VB.net and then use that date in the SQL statement. I'm thinking VB.net would be better because there are thousands of records that must be compared. I should be able to set it up in VB so that it only retrieves the date and converts it once but I am not sure what kind of performance hit each takes from these statements.
Posted: Dec 19 11 at 16:52
View 2 Replies!
How To Delete Records In Access Database
how can I delete a records in access dataabse except for sql query my code is this I would like to know if this code is wrong or not
Private Sub BindingNavigatorDeleteItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BindingNavigatorDeleteItem.Click
Posted: 17 March 2009
View 4 Replies!
Insert/Delete Records In A MSSQL Database?
I am trying to Insert/Delete records in a MSSQL database based on if a checkbox is checked or unchecked. The checkbox is an item template in a datagrid, I can check/uncheck the checkbox but it doesn't do an insert or delete. Here is my code:
But then I get the error that the control chkmap has not been declared. I am confused as to how this needs to be declared, do I set a variable to the FindControl("chkmap") and then set it as variable.checked = true ?
Posted: 08 March 2012
View 7 Replies!
Update Multiple Records In A Database?
How can I update multiple records in a database using one Update statement where the cases are different.
refundNumber = CASE _
WHEN salesRecords.invNo='1' AND itemNo='250' AND length(refundNumber) > 1 THEN _
concat(refundNumber, ', 88' ) Else '88' _
How could I translate this to an SQL CASE string?
Posted: Feb 6 at 17:32
View 3 Replies!
Update Records In SQL Server Database?
I am using Visual Studio 2008 for creating a Winforms app. I have connected a database to it called XStats. There is one table in it called XGames and in that table 2 fields, XIndex (the primary key field) and GameNumber. Using the following code I can add records to the database, the data is taken from a text box, but once added I cannot view them unless I shut down the app and restart it.
con.ConnectionString = connectionString
Dim cmd As New SqlCommand
The existing records in the database are displayed on the form in detailed view via a binding navigator. How can I make it so that I can view all the records in the database, even those that are added during the current session. As will be obvious, this is my first attempt at creating and using a database with a win forms app,
Posted: Sep 28 10 at 14:01
View 3 Replies!
How To Update Records On An Existing Access Database
how to update records on an existing access database using vb.net with just a textbox and a command button and how a specific record of a field can show up in a label or a textbox
i connected vb.net to my access database by just clicking on "add new data source">>"new connection">>"microsoft access database file" and just continue..tested connection and done.
you can see in the screenshot of my form, by default the left side textboxes are disabled but they're enabled if the user checks the checkboxes and disabled again if unchecked.
assuming that the textbox is already enabled and i want to enter a value in the Brewed Coffee area of the form...for example 5. when i click on my Submit button the value of that particular record in the database will be updated, so in my table the value of the quantity field in Brewed Coffee will be 5.
another thing is that how can i see a particular value on a label or textbox from my database like on the Prices area. in my database if a product's price is 80 then it should show a 80 in the label. the values of the prices from the screesnshot of the form are not the ones on the database xD i just typed them in.
Posted: 28 September 2009
View 3 Replies!
Update Database Records Using Multiple Threads
Been a while since I did any VB work, and have started a new project that is a Windows Service that will update a database using multiple threads. I am testing this out with a dataset that consists of a "device name" and a "device IP", pinging the device, and attempting to update the device's "status".
I have it working in a single-thread type configuration, but would like to be able to ping and update different records across multiple threads (for obvious reasons).
The problem I'm having is with the logic mainly. When the service is started, I get all the devices from the database and fill a DataSet. From there, I am looping through the dataset's rows, pinging each device and updating the record. I know how to spawn multiple threads, but I do not know how to keep track of updating the correct record and also making sure that all records are checked in some kind of order. Like, if user specifies 5 threads, I need it to get record 1, thread finishes, gets record 6 (while other threads execute), or something like that.
Note: this does no interface updating or anything like that. Only updates a database record's field value.
Posted: May 27th, 2012
View 37 Replies!
 Update Multiple Records To Sql Database?
i have 3 user roles "ALGEMEEN,OZIS,VERPLEEGKUNDIGE".And I want them added to the database.But when I use the code below it only adds the userrole "ALGEMEEN" and not the other 2.
Dim cmdCheckLidVan As New SqlCommand("SELECT COUNT(*) FROM [Lid van] WHERE [Gebruikers-ID] = @ID AND [Rol-ID] = @RolID", connection)
Dim strRolArrCount As Integer
Dim strRolArr() As String
Posted: Mar 13th, 2009
View 9 Replies!
Edit / Update Records From Database Using Textbox By Linq To Sql?
I'm using visual basic 2008 express edition by linq to sql for my database operation such as edit records. I did not use any sql server but I'm just using the built-in sql server within the visual basic 2008 express. I tried to revised the codes, no error in syntax but there's an error at runtime and it pops-up a window message saying its error message. What I want is to edit the records which were retrieved from the database into the text-boxes and when you click the button5 whatever the new value on the text-boxes should replace the previous one.The Account field is the field in my Table1 in memrec.dbml which I set up for primary key is true and the rest of the fields are false in its primary key.[code]...
Posted: Oct 14 09 at 9:18
View 3 Replies!
Edit/update Records From The Database Using Textbox By Linq To Sql?
I'm using visual basic 2008 express edition by linq to sql for my database operation such as edit records. I did not use any sql server but I'm just using the built-in sql server within the visual basic 2008 express. I tried to revised the codes, no error in syntax but there's an error at runtime and it pops-up a window message saying its error message. What I want is to edit the records which were retrieved from the database into the text-boxes and when you click the button5 whatever the new value on the text-boxes should replace the previous one.The Account field is the field in my Table1 in memrec.dbml which I set up for primary key is true and the rest of the fields are false in its primary key.The code below still found an error when you run the program and it pops-up a window which says:
NotSupportedException was unhandled - Sql server does not handle comparison of NText, Text, Xml, or Image data types.It highlights a yellow background on the line:
These are what I see on each field's property on Table1 in memrec.dbml property window:
Access - Public
Type - String(System.String)
Server Data Type - Text[code]........
Posted: Oct 14 09 at 9:18
View 3 Replies!