|
-
Aug 12th, 2003, 08:13 AM
#1
Thread Starter
Junior Member
Replace-function unknown
Hello,
I'm creating an application in VB.NET in wich it should be possible to update databases(Acces and SQL-Server). The update-queries are generated dynamically, depending on the selected database an the predefined combinations of actions saved in a database.
Ex: After dynamically building the update-command the 'DataAdapter.UpdateCommand.CommandText' gets this value:
"UPDATE Crawford_nl SET Telnr = Replace(Replace(Replace(Telnr, '*', ''), '/', ''), '-', '')"
This works fine when running it in Acces, but when I try to execute the querie in my code(DataAdapter.UpdateCommand.ExecuteNonQuery() ), I get the error: 'Undefined function Replace in expression'. After some research on the internet I've come to the conclusion that the 'Microsoft Jet 4.0 OLE DB Provider' does not support this SQL-function. Updating SQL-Server databases this way does not generate any problems. Does anyone know how to fix this?
Thanx in advance, Bmxpert
-
Aug 12th, 2003, 09:51 AM
#2
Thread Starter
Junior Member
OK, after searching a bit more, I've found that many people say that the only way to solve this problem is to make a wrapper function wich does exactly the same as the Replace function.
Function gReplace(strIn As String, strFind As String, strReplace As String) As String
gReplace = Replace(strIn, strFind, strReplace)
End Function
But stil I get the same message. Maybe something is wrong with the way I call this function in my code:
DataAdapter.UpdateCommand.CommandText = "UPDATE Crawford_nl SET Telnr = gReplace(gReplace(gReplace(Telnr, '*', ''), '/', ''), '-', '')"
Please help me with this, It's driving me crazy and I can't go on programming unless this works
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|