|
rdouglass -> RE: How could I use replace in this (6/23/2008 17:01:26)
|
quote:
Response.Write Replace(RS.GetString(,,", ",vbCrLf,""),";","-") OK, so with that line, you're replacing semi-colons with dashes: ,";","-") instead of commas but I don't think that's the real problem. The issue you're probably going to run into is that GetString will send a comma separated string and you're exporting to a CSV as well so am I correct in assuming you want to replace the commas of an individual field with dashes? Well if so, we can do some tricky stuff if we understand how GetString works. Refer to this link: http://www.w3schools.com/ADO/met_rs_getstring.asp and note the GetString 3rd Parameter 'coldel' or the column delimiter. Currently you're using a comma for your column delimiter: RS.GetString(,,", ",vbCrLf,"") See it? Actually you're using a comma and a space but that's irrelevant at this point and it suffices to say it's a comma. So since we want to replace commas in the resulting data and not in the column separator, why not substitute a different column delimiter / separator temporarily? Let's use "QQQQ" for instance. Now we *can* replace the commas in the data by using the Replace command like so: Response.Write Replace(RS.GetString(,,"QQQQ",vbCrLf,""),",","-") Notice that I replaced that comma and space delimiter with "QQQQ" to temporarily use as the 'coldel' in GetString. Now all I have to do is use replace again replacing the QQQQ with commas like so: Response.Write Replace(Replace(RS.GetString(,,"QQQQ",vbCrLf,""),",","-"),"QQQQ",",") That any closer?
|
|
|
|