-----------------------------------------------------------
New Message on BDOTNET
-----------------------------------------------------------
From: s_hashim
Message 2 in Discussion
try
this
HTH
Dim Conn As New
SqlConnection("server=ServerName;uid=sa;pwd=sa;database=DataBaseName;")
Dim sqlComm As SqlCommand
Dim
sqlStr As String
Dim i As
Integer
sqlStr = "delete from
HashimTestTable where Updateid=" &
UpdateID
Try
Conn.Open()
sqlComm = New
SqlCommand(sqlStr)
sqlComm.CommandType =
CommandType.Text
sqlComm.Connection =
Conn
sqlComm.ExecuteNonQuery()
Label1.Text = "Login Details Inserted Successfully!!"
Catch ex As
SqlException
Label1.Text = ex.Message
Catch ex
As
Exception
Label1.Text = ex.Message
Finally
Conn.Close()
End
Try
**********
Keep Smiling,
Regards.
Sayad Hashim Ali Kazi
Microsoft India
Community Star.
******************************
SQL Star International Ltd.
SQL House, #13,Infocity,Madhapur,
Hyderabad 500 081.
Tel: +91-40-2310 1650(Off) +91-98661 92794(HP)
http://dotnetjunkies.com/WebLog/SayadHashim/
http://SayadHashim.blogspot.com
http://www.mugh.net
******************************
-----Original Message-----
From: BanupriyaVelmurugan
[mailto:[EMAIL PROTECTED]
Sent: Friday, September 10,
2004 4:27 PM
To: BDOTNET
Subject: Deleting a record from
asp.net
New Message on BDOTNET
Deleting
a record from asp.net
Reply
Reply to Sender Recommend
Message 1 in
Discussion
From: BanupriyaVelmurugan
Hi
I have the code to delete a record that is already selected
in the asp.net page.
But the record is not being deleted from the database even
though I get the result as "Record deleted successfully".
The code as follows:
Private Sub btnDelete_Click(ByVal sender As
Object, ByVal e As
System.EventArgs) Handles
btnDelete.Click
Try
Dim myQuery As String =
"delete from birthday where id=" & UpdateID
Dim myCmd As SqlCommand = New SqlCommand(myQuery, SqlConnection1)
SqlConnection1.Open()
myCmd.ExecuteNonQuery()
lblResult.ForeColor = Color.Blue
lblResult.Text = "Record deleted successfully!"
Catch ex As Exception
lblResult.ForeColor = Color.Red
lblResult.Text = ex.Message.ToString()
Finally
SqlConnection1.Close()
txtEmail.Text = ""
txtName.Text = ""
drpYear.SelectedValue = Year(Now)
drpMonth.SelectedValue = Month(Now)
drpDay.SelectedValue = Day(Now)
btnDelete.Enabled = False
End Try
End Sub
Can any one please say me why the record
is not deleted even I get the result "Record deleted
successfully"?
Thanks
Banu
View other groups in this
category.
-----------------------------------------------------------
To stop getting this e-mail, or change how often it arrives, go to your E-mail
Settings.
http://groups.msn.com/bdotnet/_emailsettings.msnw
Need help? If you've forgotten your password, please go to Passport Member Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help
For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact
If you do not want to receive future e-mail from this MSN group, or if you received
this message by mistake, please click the "Remove" link below. On the pre-addressed
e-mail message that opens, simply click "Send". Your e-mail address will be deleted
from this group's mailing list.
mailto:[EMAIL PROTECTED]