|
-
Jul 27th, 2004, 11:42 AM
#1
Thread Starter
Junior Member
update and delete data
Hi,
i sorted the data when i configure the DataAdapter when load into the dataset as follow.
SELECT CustNo, CustFName, CustLName, CustTitle, CustIC, CustDoB, Deposit, JoinDate, CustAdd_1, CustAdd_2, Postcode, City, State, HomePhone, WorkPhone, HandPhone, Email, Gender FROM Customers ORDER BY CustLName.
i am having a problem of doing update and delete of the data in Customers. How do i solved these problems?? Please help.
Thanks in advance,
Viv
-
Jul 27th, 2004, 08:10 PM
#2
pls. post some code in your project for us to see..
the select statement is not enough.
-
Jul 27th, 2004, 08:13 PM
#3
Frenzied Member
-
Jul 27th, 2004, 08:20 PM
#4
halu mate Andy looks like we post on time...lol
-
Jul 27th, 2004, 08:25 PM
#5
Frenzied Member
lol i saw that too
-
Jul 28th, 2004, 12:18 AM
#6
Re: update and delete data
Originally posted by vivsm
i am having a problem ...
How do i solved these problems??
Telepathy?
-
Jul 28th, 2004, 12:36 AM
#7
Re: Re: update and delete data
Originally posted by mendhak
Telepathy?
my god...lol
-
Jul 28th, 2004, 05:26 AM
#8
Thread Starter
Junior Member
Guys,
Sorry, my mistake !!!
I am using ADO.Net. and i sorted the data by CustLName. The delete even is working but not deleted the correct data. The update even is not working at all.
heres part of the code.
Private cmCustomer As CurrencyManager
Private Sub frmCustomers_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.SqlDataAdapter1.Fill(Me.DataSet11.Customers)
cmCustomer = Me.BindingContext(Me.DataSet11.Tables("Customers"))
End Sub
Private Sub btnUpdate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnUpdate.Click
If Me.cmCustomer.Position < 0 Then
intResponse = MessageBox.Show("Database is empty !", Me.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning)
Exit Sub
Else
Try
Dim intRowSwapper As Integer = Me.cmCustomer.Position - 1
Me.cmCustomer.Position += intRowSwapper
Me.SqlDataAdapter1.Update(DataSet11)
MsgBox("Data Was SuccessFully Updated To The DataBase", MsgBoxStyle.Information, Me.Text)
Catch
End Try
End If
Private Sub btnDelete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDelete.Click
On Error GoTo fix
Dim intResponse As Integer
If cmCustomer.Position < 0 Then
intResponse = MessageBox.Show("Database is empty !", Me.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning)
Exit Sub
Else
intResponse = MessageBox.Show("Are you sure want to delete this data ?", Me.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question)
If intResponse = vbYes Then
SqlConnection1.Open()
If cmCustomer.Count > 0 Then
Me.cmCustomer.RemoveAt(cmCustomer.Position)
End If
SqlDataAdapter1.Update(DataSet11)
MsgBox("Data was successfully Deleted from DataBase", MsgBoxStyle.Information, Me.Text)
SqlConnection1.Close()
End If
End If
fix:
Exit Sub
End Sub
Please help!!!
viv
-
Jul 29th, 2004, 02:34 AM
#9
Thread Starter
Junior Member
Hi,
i still cannot solve the problem. it always deleted the wrong data .
Please help!!
viv
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|