Click here to Skip to main content
15,918,050 members

Comments by dbrenth (Top 28 by date)

dbrenth 2-Nov-23 13:41pm View    
I don't see where you have initialized the variables "server", "database", "username" and "password". When you set a string with the $ prefix, the parts in {} will be replaced with the variables or functions inside the brackets. If there is nothing, NULL will be returned and that could be your NULL that is causing the Invalid Cast Exception.
dbrenth 5-Jul-23 15:11pm View    
I answered the question with the assumption that they didn't have the ability to alter the table. And also as a challenge to myself to see if I could actually do it in a single SQL statement. I agree it is far from ideal for performance and maintenance.
dbrenth 7-Dec-22 11:55am View    
The Interop Libraries require Word to be installed. And you cannot correctly open a word document without the interop libraries. So probably not.
dbrenth 7-Dec-22 11:54am View    
To be fair to the OP. Your link takes you to a page with broken links and other links that require Word to be installed (against his requirement). I think it would be more helpful to direct him to a google page that says "You cannot use the Interop libraries without Office installed." And the interop libraries are required to correctly read a word document.
dbrenth 12-Sep-19 8:04am View    
Also don't keep closing and opening the connection. At the end of the using statement the connection will be closed automatically. It can remain open throughout the using statement.