Replace by "
Hi,,,,
this is my code..
strAryWords = Split(readln, " ")
dId = strAryWords(0)
dName = strAryWords(1)
dPayout = strAryWords(2)
dType = strAryWords(3)
adoCon.Execute "Insert Into TABLE(ID, Name, Payout, Type) Values('"& dId &"','"& dName &"','"& dPayout &"','"& dType &"')"
now in my dName field I am getting name like : America's great toy...
Then it ll not allow to pass dName in table..
Its giving error :
Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression ''America's great toy','33.50','lead')'.
/Data.asp, line 31
Now I am replacing
dName=Replace(dName,"'","") then its adding data to DB..
But I dont want to discard (') . I just want Data As it is ..
Is it Possible ??
Or Shall I replace (') by any other String ??
PLZ Solve this...
[1076 byte] By [
tejalm] at [2007-11-19 19:53:30]

# 5 Re: Replace by "
Hi..
Have another query...
I have CSV file and I have fields like ID, Name, Value..
In name field many times value s like::
"America's Greatest Offer, get FREE"...
So here comma coming and its separating and I am not getting proper data in table.
# 8 Re: Replace by "
Hi,
I have one CSV file and its field containing comma itself so when I am splitting by comma to get all data in ACCESS locally on my pc its giving error.
What to do for this ??
Code ::
<%
Dim adoCon
Dim rs
Dim strSQL
dim DNS
DSN = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & Server.Mappath("MAP.mdb") & ";"
Set adoCon = Server.CreateObject("ADODB.Connection")
adoCon.Open(DSN)
Set rs = Server.CreateObject("ADODB.Recordset")
adoCon.Execute "Delete * from Affiliate"
Dim filename, content
filename = "E:\\Affiliate.txt"
Set fs=Server.CreateObject("Scripting.FileSystemObject")
Set f=fs.OpenTextFile(filename, 1)
dim i,j,readln,lined,strAryWords
dim dId,dType,dName,dPayout
do while f.AtEndOfStream = false
readln=f.ReadLine
strAryWords = Split(readln, ",")
dId = strAryWords(0)
Response.Write("ID : "+dId+"<br>")
dName = strAryWords(1)
dName=Replace(dName,"'","''")
Response.Write(dName+"<br>")
dPayout = strAryWords(2)
Response.Write(dPayout+"<br>")
dType = strAryWords(3)
Response.Write(dType+"<br>")
adoCon.Execute "Insert Into Affiliate(ID, Name, Payout, Type) Values('"& dId &"','"& dName &"','"& dPayout &"','"& dType &"')"
loop
f.Close
Set f=Nothing
Set fs=Nothing
%>
Its giving error as
Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression '' Master's',' or Doctorate degree at home!"')'.
/quick/MAP/Afl_data.asp, line 37
Bcoz line is like ::
"Kennedy Western - Earn your Bachelor's, Master's, or Doctorate degree at home!"
I have enclosed all data in before getting file..
So every field containing " at starting and ending.
Please solve this
Thanks