Forum Home
Press F1
 
Thread ID: 46014 2004-06-10 05:36:00 ASP (classic) DB george12 (7) Press F1
Post ID Timestamp Content User
243279 2004-06-10 05:36:00 Hi, I am trying to construct a function to update database fields using a command like this:

SaveUserData( " George " , " Email " , " g_dewar@jgih.com " )

For this I need the function to be basicly

Function SaveUserData(UserName,Field,Value)
(open db)
(run sql)
(close db)
End Function

Where the database connection string is:
" Driver={Microsoft Access Driver (*.mdb)};DBQ=c:\inetpub\wwwroot\db\users.mdb "

And the SQL to update the field is:
" UPDATE Users SET " & Field & " = " & Value & " WHERE UserName = ' " & UserName & " ' "

How can I do this? I have managed it in ASP.net but really don't want to use that because it doesn't support page-render functions.
george12 (7)
243280 2004-06-10 07:40:00 Full connection using DSN:theDSN = "DSN=dsnname;uid=username;pwd=password"
set conn = server.createobject("adodb.connection")
conn.open theDSN
conn.execute sqlstatement
conn.close
set conn = Nothing
Using a DSN is not the most efficient connection as I think you probably already know, but you get the idea. Excellent info about asp and databases can be found here (www.learnasp.com).
antmannz (28)
1