I'd like to update or insert a new record into a SQL Server 2005 database using VB.net.
Knowing that my values will contain single quotes, I'd prefer to update the fields within my tables using the individual field names rather than a blanket INSERT command.
For example, in VB6, I could write something as follows to accomplish the above:
sSql = "SELECT * FROM MyTable"
objMyRst.Open sSql, cnn, adOpenKeyset, adLockOptimistic, adCmdText
If objMyRst.EOF Then
If objMyRst.State = 1 Then objMyRst.Close
sSql = "MyTable"
objMyRst.Open sSql, cnn, adOpenKeyset, adLockOptimistic, adCmdTable
objMyRst!Testfield = Now()
Any help in performing both the insert and update would be appreciated.