Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
248 views
in Technique[技术] by (71.8m points)

database - SQL to Replace Specific Text in Field Not Working

I'm trying to make text replacements on a particular FIELD in an Access.accdb and it is not working. No errors, just no change. I'm working in vb.net.

I'm using the following:

    Dim AccessConn As System.Data.OleDb.OleDbConnection
    AccessConn = New System.Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=c:empTEST.accdb")

    AccessConn.Open()
    Dim strSQL As String = "UPDATE [TEMPData] SET [Filetype] = REPLACE([Filetype], 'PDF', 'XXX')"
    Dim AccessCommand As New System.Data.OleDb.OleDbCommand(strSQL, AccessConn)
    AccessConn.Close()

My ULTIMATE goal is to make a text replacement of a substring in a FIELD (e.g. "---PDF---" is changed to "---XXX---". But as it stands now, I can't make any replacement.

I appreciate any kind of help, thanks


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...