dimitrio 0 Newbie Poster

Im new in VB .Net. My problem is the ff:
1. Existing table, fs_account has field name: emp_num, fs_id, fs_lastname, fs_firstname.

2. I create tblfacultystaff table, it has fsaccountid, user_m.

3. I want to insert records from fs_account to tblfacultystaff or if there was changes in fs_account table, tblfacultystaff table will be updated.

i create a button update in aspx, my problem is, i would like to process it was the button is clicked. can u help me this out. i have a code kindly fix it

Private Sub btnUpdateProcess_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnUpdateProcess.Click
Dim IsExist As Boolean = FindSomething("SELECT fs.EMP_NUM, fs.fs_id, tfs.FSACCOUNTID, tfs.USER_M FROM fs_account AS fs LEFT JOIN tblfacultystaff AS tfs ON fs.EMP_NUM = tfs.USER_M AND fs.fs_id = tfs.FSACCOUNTID;")

Try
cnn.Open()
dr = cmd.ExecuteReader()

Do While dr.Read
If Not IsExist Then
ExecuteSQL("INSERT INTO tbltblfacultystaff (FSACCOUNTID, USER_M) " & _
"VALUES (fs_account.fs_id, fs_account.EMP_NUM")
else
ExecuteSQL("Update tblfacultystaff SET FSACCOUNTID=fs_account.fs_id, USER_M=fs_account.EMP_NUM WHERE FSACCOUNTID=fs_account.fs_id;")
Loop

Catch ex As Exception

Finally
dr.Close()
cnn.Close()
If Not cnn Is Nothing Then
cnn.Dispose()
End If
End Try
End Sub

kindly help me, please asap. i can't find any solution. thanks in advance.

Dimitrio
-=Newbie=-

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.