crazyswede Posted February 15, 2018 Share Posted February 15, 2018 var ConnectionString = "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" + AbsolutePathToAccessFile + ";"; var ConnectionObject = Server.CreateObject("ADODB.Connection"); ConnectionObject.Open( ConnectionString ); var sql = "SELECT * FROM santa1 "; var rs = Server.CreateObject("ADODB.RecordSet"); rs.Open (sql, ConnectionObject); fff = GetFieldToRead( databasename ); --------------------------------- My program reads an *.mdb file----> SantaName = rs("man1").Value But it changes every month - February= rs("man2").Value, march= rs("man3").Value, and so forth. I could and have used if-statements, but I want to learn how to build or customize that command. Would it be like you build a string? - = "rs(/""+ fff +"/").Value)", where fff signifies man1 or man2 or man3, etc. Just point me in the right direction and I'll study it. Link to comment Share on other sites More sharing options...
justsomeguy Posted February 15, 2018 Share Posted February 15, 2018 It's possible to build a string of code and then use eval to execute it, but that's generally considered to be bad practice especially if any user-entered data is part of that command. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now