Hello World!
I am trying to convert my project in vb6.0 to vb.net '05 ^ ^. I can add and delete records but I have a problem in updating records.
[CODE=vbnet]Private Sub btnOK_Click(ByV al sender As System.Object, ByVal e As System.EventArg s) Handles btnOK.Click
If AddCourse = True Then
SQLString = "Insert Into Courses ([CourseID],[Title],[Description]) Values ('" & _
txtCourseID.Tex t & "','" & txtTitle.Text & "','" & txtDescription. Text & "')"
Call DoTransactions( SQLString)
MessageBox.Show ("New course has been sucessfully added.", _
"Course Added", MessageBoxButto ns.OK, MessageBoxIcon. Information)
Else
SQLString = "Update Courses Set Title='" & txtTitle.Text & "', Description='" & _
txtDescription. Text & "' Where CourseID='" & txtCourseID.Tex t & "'"
Call DoTransactions( SQLString)
MessageBox.Show ("New course has been sucessfully added.", _
"Course Updated", MessageBoxButto ns.OK, MessageBoxIcon. Information)
End If
End Sub
Private Sub DoTransactions( ByVal StringCommand As String)
'Set Database Connection
Call SetConnection()
cmdCourses = New OleDbCommand(St ringCommand, dbConnection)
cmdCourses.Comm andType = CommandType.Tex t
rsCourses = cmdCourses.Exec uteReader
'Close Connection
rsCourses.Close ()
Call CloseConnection ()
'Refresh List
Call frmCourses.Load Courses()
Me.Close()
End Sub[/CODE]
Rey Sean
I am trying to convert my project in vb6.0 to vb.net '05 ^ ^. I can add and delete records but I have a problem in updating records.
[CODE=vbnet]Private Sub btnOK_Click(ByV al sender As System.Object, ByVal e As System.EventArg s) Handles btnOK.Click
If AddCourse = True Then
SQLString = "Insert Into Courses ([CourseID],[Title],[Description]) Values ('" & _
txtCourseID.Tex t & "','" & txtTitle.Text & "','" & txtDescription. Text & "')"
Call DoTransactions( SQLString)
MessageBox.Show ("New course has been sucessfully added.", _
"Course Added", MessageBoxButto ns.OK, MessageBoxIcon. Information)
Else
SQLString = "Update Courses Set Title='" & txtTitle.Text & "', Description='" & _
txtDescription. Text & "' Where CourseID='" & txtCourseID.Tex t & "'"
Call DoTransactions( SQLString)
MessageBox.Show ("New course has been sucessfully added.", _
"Course Updated", MessageBoxButto ns.OK, MessageBoxIcon. Information)
End If
End Sub
Private Sub DoTransactions( ByVal StringCommand As String)
'Set Database Connection
Call SetConnection()
cmdCourses = New OleDbCommand(St ringCommand, dbConnection)
cmdCourses.Comm andType = CommandType.Tex t
rsCourses = cmdCourses.Exec uteReader
'Close Connection
rsCourses.Close ()
Call CloseConnection ()
'Refresh List
Call frmCourses.Load Courses()
Me.Close()
End Sub[/CODE]
Rey Sean