I am reading a .csv file and it is reading the IntNote field as numbers instead of text...so, when I do an insert into another table based on that .csv file, I am loosing all the text information. Can anyone help?
connection:
strConn = "Driver={Microsoft Text Driver (*.txt; *.csv)}; Dbq=d:\inetpub\WebECIS\QuotesUpload\; HDR=Yes; Extensions=asc,csv,tab,txt; IMEX=1"
Set dbc = Server.CreateObject("ADODB.Connection")
dbc.open strConn
This is where it reads the file and does an insert into an sql table:
set rs = Server.CreateObject ("adodb.RecordSet")
ssql = "SELECT Qty, CustItem, Mfg, Part, TotQty, TargetPrice, Notes, FacMin, MinQty, StdPkgQty, CustMinQty, CustMultQty, Delivery, IntNote FROM [QuoteUpload.csv]"
rs.Open ssql, dbc, adOpenForwardOnly, adLockReadOnly
do while not rs.eof
'response.write(rs("Part"))
intMaxSeq = intMaxSeq + 1
set rs1 = Server.CreateObject ("adodb.RecordSet")
ssql = "SELECT ID, LastCost FROM INVENTORYMASTER1 WHERE ([PART #] = '"&rs("Part")&"')"
rs1.Open ssql, dbc1, adOpenForwardOnly, adLockReadOnly
if not rs1.eof then
intPartID = rs1("ID")
intLastCost = rs1("LastCost")
else
intPartID = 0
intLastCost = 0
end if
rs1.close
set rs1=nothing
if len(rs("TotQty")) > 0 then
intTotQty = rs("TotQty")
else
intTotQty = "null"
end if
if len(rs("TargetPrice")) > 0 then
intTargetPrice = rs("TargetPrice")
else
intTargetPrice = "null"
end if
if len(rs("FacMin")) > 0 then
intFacMin = rs("FacMin")
else
intFacMin = 0
end if
if len(rs("MinQty")) > 0 then
intMinQty = rs("MinQty")
else
intMinQty = "null"
end if
if len(rs("StdPkgQty")) > 0 then
intStdPkgQty = rs("StdPkgQty")
else
intStdPkgQty = "null"
end if
if len(rs("CustMinQty")) > 0 then
intCustMinQty = rs("CustMinQty")
else
intCustMinQty = "null"
end if
if len(rs("CustMultQty")) > 0 then
intCustMultQty = rs("CustMultQty")
else
intCustMultQty = "null"
end if
strIntNote = Left(StripQuotes(rs("intNote")),255)
ssql = "INSERT INTO [QUOTES DETAIL] "
ssql = ssql & " (Notes, [QUOTE #], Qty, [CUST ITEM #], MFG, [PART #], SEQ, TotQty, PartID, [DEE COST], Turns, WgtFctr, TargetPrice, FacMin, MinQty, StdPkgQty, CustMinQty, CustMultQty, Delivery, IntNote)"
ssql = ssql & " VALUES ('"&StripQuotes(Left(rs("Notes"),100))&"', "&intQuoteNum&", '"&StripComma(rs("Qty"))&"', '"&left(rs("CustItem"),50)&"', '"&left(rs("Mfg"),50)&"', '"&StripQuotes(left(rs("Part"),50))&"', "&intMaxSeq&", "&StripComma(intTotQty)&", "&intPartID&", "&intLastCost&", 4.5, .003, "&StripComma(intTargetPrice)&", "&StripComma(intFacMin)&", "&StripComma(intMinQty)&", "&StripComma(intStdPkgQty)&", "&StripComma(intCustMinQty)&", "&StripComma(intCustMultQty)&", '"&Left(StripComma(rs("Delivery")),50)&"', '"&StripComma(strIntNote)&"')"
response.write(ssql&"<br><br>")
dbc1.execute(ssql)
rs.moveNext
Loop
Any ideas what the deal is? An example of data would be:
actual data: 0.645 allied
imported data: 0.645
it chopped off the allied portion, but wierd is it kept the 0 of 0.645.