SQL Server Performance Forum – Threads Archive
openrowset on an access databaseI’m close to tears, i’m hoping someone can help me with this crap. I’m using an OPENROWSET on an access database, i need to pass a date as a parameter from a C# application. This won’t work: OPENROWSET(… DateAndTime > @dateParam …) with the general DbParameter dbp = cm.CreateParameter() it just says the query is malformed. The problem is that when i use the #1-1-1900# format and just do a textual replace i can’t get it to use the milliseconds, the DateTime.ToString() rounds the date and i need the _exact_ date, not some rounded piece of garbage… Anyone?
Unfortunately openrowset will not support parameters directly. You can create the whole statement as one string and do an exec (statement) but it gets pretty tricky writing the string. Can you create a linked server on the access db and refer to it that way? Rob Mills