By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,373 Members | 1,792 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,373 IT Pros & Developers. It's quick & easy.

hello me vb application to oracle connection

P: 15

this is the code i wrote for my application to retrieve values,delete values,update values and insert values...

i am havin doubt in delete and retrieve snippets whether it works right. and deletion should ask for the primarykey which is traderid over here and on getting it,it retrieves all details for the particular user and deletes it. i couldnt check out right now as i dont have connection.

'adodc control

Private Sub Adodc1_WillMove(ByVal adReason As ADODB.EventReasonEnum, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset)

End Sub

'reset all values/clear the values

Private Sub Command9_Click()

firstname.Text = ""
middlename.Text = ""
lastname.Text = ""
sex.Text = ""
city.Text = ""
state.Text = ""
country.Text = ""
mailid.Text = ""
userid.Text = ""
password.Text = ""
traderid.Text = ""

End Sub

'retrieve contents
Private Sub Command1_Click()

Dim sql As String
sql = "select * from trader;"
'specify format of SQL result and assisgn to ADODC
Adodc1.CommandType = adCmdText
Adodc1.RecordSource = sql

End Sub

'insert records

Private Sub Command3_Click()


Adodc1.Recordset.Fields("firstname") = firstname.Text
Adodc1.Recordset.Fields("middlename") = middlename.Text
Adodc1.Recordset.Fields("lastname") = lastname.Text
Adodc1.Recordset.Fields("sex") = sex.Text
Adodc1.Recordset.Fields("city") = city.Text
Adodc1.Recordset.Fields("state") = state.Text
Adodc1.Recordset.Fields("country") = country.Text
Adodc1.Recordset.Fields("mailid") = mailid.Text
Adodc1.Recordset.Fields("userid") = userid.Text
Adodc1.Recordset.Fields("password") = password.Text
Adodc1.Recordset.Fields("traderid") = traderid.Text


MsgBox "Data inserted and updated"
End Sub

'delete records by retriving the details using traderid details and deleting.

sql = "select firstname,middlename,lastname,sex,city,state,count ry,mailid,panno,userid,password,traderid from trader where traderid=&traderid;"
If Adodc1.Recordset.EditMode = adEditDel Then
If MsgBox("Do you really want to delete ?", vbYesNo) = vbYes Then
End If
End If
Unload Me

End Sub
Sep 4 '07 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.