I'm creating a Visual Basic program linked to an SQL server DB. In one of my tables I have a field for phone number which is an nvarchar datatype that is stored in the following format (example: 617-782-6415).
I have a form where I want to view the contents of the following recordset:
SELECT d .ACCOUNT_CODE, d .DURATION, d .[DATE], d .[HOUR], d .NUMBER_DIALED, p.ACCOUNT_CODE AS Expr1, p.LAST_NAME, p.FIRST_NAME,
p.SUMMARY_GROUP, p.DIRECT_DIAL, p.TITLE, p.LOCATION, p.DIVISION, p.DEPARTMENT, p.DIRECTOR, p.OLD_CARD_NUM, p.REISSUE, p.CLASS,
p.PHONE
FROM DETAIL d INNER JOIN
PHONE_EMP_MAST p ON d .ACCOUNT_CODE = p.ACCOUNT_CODE
WHERE number_dialed = " & astring & "
The value for astring is pulled from a combobox that stores all the values for number_dialed. However when i run this program i get the error message
"syntax error converting the nvarchar value '401-781-7078' to a column of datatype int"
I dont need to convert it to a column of datatype int so I dont understand this error... can anyone help me?