Delete record using code
Delete record using code
Delete record using code
Delete record using code
Delete record using code
Delete record using code Delete record using code Delete record using code Delete record using code Delete record using code Delete record using code Delete record using code Delete record using code
Delete record using code Delete record using code
Delete record using code
Go Back  Xtreme Visual Basic Talk > > > Delete record using code


Reply
 
Thread Tools Display Modes
  #1  
Old 05-07-2015, 09:12 PM
VPL VPL is offline
Newcomer
 
Join Date: Apr 2015
Posts: 1
Default Delete record using code


I am new to vb.net and started learning it for the last two weeks.

I created one table in Access with following fields

a. Request ID
b. Person Name
c. Request Date
d. Customer Type (New or already existing)
e. Customer Code
f. Customer Name

I tried to delete a record with following code
Code:
Private Sub Form2_Load(sender As Object, e As EventArgs) Handles Me.Load
        dbProvider = "PROVIDER=Microsoft.Jet.OLEDB.4.0;"
        dbSource = "Data Source = E:\sample-status\ggoe.mdb"
        con.ConnectionString = dbProvider & dbSource
        con.Open()
        sql = "SELECT * FROM samplerequest"
        da = New OleDb.OleDbDataAdapter(sql, con)
        da.Fill(ds, "ggoe")
        'con.Close()
        MaxRows = ds.Tables("ggoe").Rows.Count
End Sub
==========================================

Private Sub Delete_Click(sender As Object, e As EventArgs) Handles Delete.Click
        inc = 0
        For inc = 0 To MaxRows
        	If Val(RequestNo.Text) = inc Then
        inc = inc - 1
       	 Dim cb As New OleDb.OleDbCommandBuilder(da)
If MessageBox.Show("Do you really want to Delete this Record?", "Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) = DialogResult.No Then
        MsgBox("Operation Cancelled")
        Exit Sub
        End If
        ds.Tables("ggoe").Rows(inc).Delete()
       	 MaxRows = MaxRows - 1
        da.Update(ds, "ggoe")
       	 Exit Sub
        End If
        Next inc
    End Sub
==================================
I got error message "One of the parameter is missing"

Please help me to correct this error.

Last edited by Flyguy; 05-08-2015 at 02:20 AM.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Delete record using code
Delete record using code
Delete record using code Delete record using code
Delete record using code
Delete record using code
Delete record using code Delete record using code Delete record using code Delete record using code Delete record using code Delete record using code Delete record using code
Delete record using code
Delete record using code
 
Delete record using code
Delete record using code
 
-->