Symbianize Forum

Most of our features and services are available only to members, so we encourage you to login or register a new account. Registration is free, fast and simple. You only need to provide a valid email. Being a member you'll gain access to all member forums and features, post a message to ask question or provide answer, and share or find resources related to mobile phones, tablets, computers, game consoles, and multimedia.

All that and more, so what are you waiting for, click the register button and join us now! Ito ang website na ginawa ng pinoy para sa pinoy!

Vb. Net 2010 error help

clynnekent

Recruit
Basic Member
Messages
13
Reaction score
0
Points
16
Good day, I am back again. Its been a long time when I visit this forum.Today I ask for a help to all the professional programmer here.I have this code.

Dim msg As Integer
msg = MsgBox("Do You Really Want To Delete This Employees Name:- '" & txtfname.Text & "' ?", MsgBoxStyle.YesNoCancel, "Delete Record ?")
If msg = DialogResult.Yes Then
Try

cmd.Connection = cn
cmd.CommandText = "Delete from tblemprecord where empid='" & txtidno.Text & "'"
cmd.ExecuteNonQuery()
MsgBox("Record Deleted Sucessfully.")

Catch ex As Exception
MsgBox(" Record Not Deleted.")
End Try
End If
'cn.Close()
End Sub

The problem is where I press button delete the message box pop up like this "Do You Really Want To Delete This Employees Name:- Name?" after you choose Yes the Try Catch Message Box "Record Not Deleted." pop up and nothing happen. Any help to find the error. I want the output "Do You Really Want To Delete This Employees Name:- Name?"if I choose Yes then the Msgbox Record Deleted Sucessfully" then the record will deleted in the database. by the way I'm using VB 2010 and MS Access 2010. and Im using Textbox to search the Id number.

Thanks for the help..
 
Last edited:
add mo nga to para lumabas yung error.
Code:
Msgbox(ex.Message)

sa
Code:
Catch ex As Exception
MsgBox(" Record Not Deleted.")
End Try
End If
'cn.Close()
End Sub


Ano ba data type ng empid sa database mo? Int or Number?
If int or number, baguhin mo to:
Code:
cmd.CommandText = "Delete from tblemprecord where empid='" & txtidno.Text & "'"

to
Code:
cmd.CommandText = "Delete from tblemprecord where empid=" & Convert.toInt32(txtPrice.Text)
 
add mo nga to para lumabas yung error.
Code:
Msgbox(ex.Message)

sa
Code:
Catch ex As Exception
MsgBox(" Record Not Deleted.")
End Try
End If
'cn.Close()
End Sub


Ano ba data type ng empid sa database mo? Int or Number?
If int or number, baguhin mo to:
Code:
cmd.CommandText = "Delete from tblemprecord where empid='" & txtidno.Text & "'"

to
Code:
cmd.CommandText = "Delete from tblemprecord where empid=" & Convert.toInt32(txtPrice.Text)

Thanks for reply sir. nakuha kuna nasa database ko ang mali.yung DateTimePicker kasi string pag save yung nalagay ko sa Access Date/Time.

Maraming salamat sa reply sir.
 
Back
Top Bottom