我在数据库中有字符串。我想搜索角色" d"并将其替换为" D"使用Visual Basic,但我不知道正确的方法。
我试过这样的事情
Private Sub Command1_click()
Dim search As Variant
sstr = InputBox("d")
data1.recordset.findfirst "Author='" & sstr & "'" ' Look for the record that has a value "sstr"
If trim(sstr) <> "" Then
If data1.RecordSet.NoMatch Then 'check if the record exist
MsgBox "No record Exist"
Command1.setfocus
Else
If orginalstring.Contains("d") Then
modifedstring = orginalstring.Replace ("d" , "D")
Console.WriteLine(modifiedstring)' = D"
data1.Refresh ' refresh the DBGRID or MSFLEXGRID
End If
Console.readkey()
End If
End Sub
关于如何实现这一点的任何想法?